hi...i'm new with c++ and I was wondering what does that const do, I've seen it in a lot of examples in a c++ book I'm reading but don't know, or find it in the book, if the writter mentioned that...so please help me understand...
hi...i'm new with c++ and I was wondering what does that const do, I've seen it in a lot of examples in a c++ book I'm reading but don't know, or find it in the book, if the writter mentioned that...so please help me understand...
Its used for member functions. It indicates that the function will not change the state of the object it is working on. For example, if you have a getName() function that returns a name, it doesn't actually change anything with the class, so you would make it const.
thanks a lot daved...now it makes a little more sense...and it shades a little light on some erros that I got....