Update of "Calling overridden base methods"
Not logged in
Overview

Artifact ID: b873f24c9dfa7cbf380b3320fb999c06837069e8
Page Name:Calling overridden base methods
Date: 2013-01-17 21:52:30
Original User: Les Farrell
Content

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:


object-name.base-class-name::method-name();


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.