Hey there everyone,
I have another brain teaser for ya...this was just something I read that didn't quite make sense to me, maybe someone has a more insightful understanding of what I'm about to bring up. So currently I'm learning about passing function arguments by reference. In the middle of learning this I stumbled upon a passage in one of my C++ books that said (and this is a direct quote): "if your intent is that a function use the information passed to it without modifying the information, and if you're using a reference, you should use a constant reference..."
Now correct if I'm wrong but isn't the point of passing by reference to make it so you're working with the actual data from the calling function and thus you're making it a point to alter the data? Why would you create a const reference? I was just wondering if this is bad information or if there is actually a necessity for a const reference somewhere along the line, as far as my understanding goes right now (which, I know, isn't too far...but it's far enough to make me question what I just read) a const reference seems unnecessary...any further revelations into this curiosity of mine would be really cool...thanks to anyone who replies to this -Chap