We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I think this is a bad introductory example; as the C++ FAQ discusses:
Should a derived class redefine ("override") a member function that is non-virtual in a base class?
It's legal, but it ain't moral.
This particular example seems to be quite contrived (the 'is-a' relationship between RectangleArea and Rectangle is not there) and encourages practices that shouldn't be followed in general.
Rectangle Area
You are viewing a single comment's thread. Return to all comments →
I think this is a bad introductory example; as the C++ FAQ discusses:
This particular example seems to be quite contrived (the 'is-a' relationship between RectangleArea and Rectangle is not there) and encourages practices that shouldn't be followed in general.
It makes more sense for Display to be virtual.