diff options
Diffstat (limited to '6p15.cpp')
-rw-r--r-- | 6p15.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/6p15.cpp b/6p15.cpp new file mode 100644 index 0000000..be65157 --- /dev/null +++ b/6p15.cpp @@ -0,0 +1,35 @@ + +/* + * + * 6.15 + * + * + */ + +int main () { + + /* + Why is s a reference to const? + Because we just need read access to it, we are checking the size + + Why is occurs a plain reference? + Because we want to return information through occurs so we need write access + + Why is c not a reference? + 'c' is the character we are looking for. I suspect it's not a reference because + if we accidentally change c then we could have some serious bugs. It would probably + be fine if we did const reference to char but it really does not matter much. + + What if we made s a plain reference? + I don't think it would matter much with the function as it is right now but it would + make it so if someone modifies the function, they could make a mistake and somehow + change the contents of 's'. Because we have const reference we ensure that we can only + read and not write. + + What if we made occurs a reference to const? + The function would not work and perhaps not even compile. We would not be able to return + the information through the reference + + */ + return 0; +} |