12 Object-Oriented Programming: Polymorphism
Objectives
In this chapter you’ll:
See how polymorphism makes programming more convenient and systems more extensible.
Understand the relationships among objects in an inheritance hierarchy.
Use C++11’s
overrides
keyword when overriding a base-class virtual function in a derived class.Use C++11’s
default
keyword to autogenerate avirtual
destructor.Use C++11’s
final
keyword to indicate that a base-class virtual function cannot be overridden.Create an inheritance hierarchy with both abstract and concrete classes.
Determine an object’s type at runtime using runtime type information (RTTI),
dynamic_cast
, typeid and type_info.Understand how C++ can implement virtual functions and dynamic binding. ...
Get C++ How to Program, 10/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.