Hello people, I need an example and explination of the const keyword used in method signatures. I'm using a really, crappy book and i don't understand what they are trying to say. Thanks!
Hello people, I need an example and explination of the const keyword used in method signatures. I'm using a really, crappy book and i don't understand what they are trying to say. Thanks!
Last edited by Gamma; 04-15-2002 at 09:36 PM.
It means it does not change values.
That's just something quick I threw together to show you. There might be some syntax errors.Code:class foo {public: int returnint() const;//doesn't change the value of it void setint(int number); private: int data=0; } int returnint() const { return data;} void setint(int number) { data=number}