In This Chapter
Discovering how polymorphism (a.k.a. late binding) works
Finding out how safe polymorphic nachos are
Overriding member functions in a subclass
Checking out special considerations with polymorphism
The number and type of a function’s arguments are included in its full, or extended, name. This enables you to give two functions the same name as long as the extended name is different:
void someFn(int);void someFn(char*);void someFn(char*, double);
In all three cases, the short name for these functions is someFn() (hey! this is some fun). The extended names for all three differ: someFn(int) versus someFn(char*), and so on. C++ is left to figure out which function is meant by the arguments during the call.
Member functions can be overloaded. The number of arguments, the type of arguments, and the class name are all part of the extended name.
Inheritance introduces a whole new wrinkle, however. What if a function in a base class has the same name as a function in the subclass? Consider, for example, the ...