This is not UB in itself. You get undefined behavior when you drop a constant and use the resulting glvalue to modify the object that was originally declared const. Here's the standard quote ( [dcl.type.cv] / 4 ):
Except that any member of the class declared mutable can be modified, any attempt to modify the const object during its lifetime results in undefined.
A simple call to a member function is not a modification of an object. It all depends on what the function does. So if he does something crazy, like:
std::memset(this, 0, sizeof(*this));
This will lead to undefined behavior, of course. But if we assume that this is not so, and since there are no members to change it in an incorrectly formed form, UB will not be called.
Another question, whether he has a good idea, has an obvious answer. Consoles should not clog code bases. But if the base class behaves well, although it is not clearly defined, it may be acceptable if you cannot change the class.
source share