puzzlecracker wrote:
I am just curious: if you declare an object constant - can it call NOT
constant member functions of the class or only constant ones?
I believe only const member functions may be called on a const object.
are there generic rules for such objects?
const objects are meant to be non-changing. A function that will not
alter the instance it is operating on should be labeled as const to
represent this fact. Member functions that do change the internals of
their instances must not be used on an object that is not supposed to
change.
It is pretty straight forward if you keep in mind what 'const' means.
It means 'constant'.
Hope that helps.