0
What happens when a normal object wants to call a constant member function??
3 Réponses
+ 3
Like what @Vladislav stated, it depends. If the normal object calls a constant member just to modify it, it will throw an error. Otherwise, it will work like a normal function.
+ 1
Constant member functions guarantees that fields of object won't be modified.
If object is marked as const, calling the non-constant function will throw an error.
So if const function doesn't modify - the code works, if it does - compiler throws an error.
0
A normal object calls a constant member function with no error! :)