Calling overridden base methods
Not logged in

Calling overridden base methods

Any base class method can be called by explicitly stating its class and name, separated by the :: double-colon scope operator. This is useful to call base method that have been overridden by derived class methods.

It is important to get the syntax order correct by ensuring that the base class name and the scope operator immediately precedes the object name. The syntax looks like this:


The example demonstrates how to explicitly call the two overridden base walk class methods. It uses the same mammal3.hpp and cat3.hpp header files listed on pages 140-141.