|
|
Polymorphic Variables
|
Only pointers and reference variables have the potential for polymorphism. |
Overloading
|
Overloading
|
Overriding - functions in both the parent and
child which have the same name and same parameters
|
Overriding - same as Budd's description for
overriding for refinement and replacement with a couple of extra
considerations
|
Deferred Methods
Methods are defined in the parent but not implemented. It is up to the child class to implement the methods. |
Pure virtual methods - at least one method in a parent class has a pure virtual method. The compiler requires that all children of this class define a method for any pure virtual methods. Also, it is impossible to declare a variable of the parent class. You can declare pointers or reference variables to the parent class. |
Pure Polymorphism | Doesn't exist in C++ |
Generics and Templates | Templates - Chapter 14 pg. 615 in LaFore The idea is for the writer of the class(or function) to write the class (or function) as an outline. All the information is there, but the type is designated by a "dummy" name. When instantiating a template class, the user of the class will instantiate it and will specify a type to use (like int, Rational, etc.). The compiler will actually create a version of the class and will substitute the specified type for the dummy type given in the outline. This is a form of overloading. In this case, the compiler "writes" all the different versions needed instead of the programmer. |