| C++ Program Design, 3/e James P. Cohoon,
University of Virginia Jack W. Davidson,
University of Virginia
Templates and polymorphism
Chapter ObjectivesUpon completion of this chapter the student will understand and be able to utilize the following key concepts:
Polymorphism is a language mechanism that permits the same code expression to invoke different functions depending upon the type of objects using the code. |
| | | We explore some C++ methods for achieving polymorphism. |
| | | A template, when invoked with particular types and values, can generate a new function or class. |
| | | Another method of achieving polymorphism is through virtual member functions. This method is sometimes called pure polymorphism. |
| | | In an expression involving a virtual function invocation, the decision on which function to use is delayed until run time. |
|