Summary

In this hour, you learned how to use the dynamic_cast operator to cast down the inheritance hierarchy. You also learned why this may be a sign of poor class design.

You also saw how to create abstract data types using pure virtual functions and how to implement the pure virtual functions so that they can be used by derived classes. Any class with a pure virtual function is abstract, and abstract classes may not be instantiated. You examined how you can create hierarchies of abstract data types to represent abstractions in your design, and how you must ultimately create non-abstract (concrete) classes which can be instantiated.

Get Sams Teach Yourself C++ in 24 Hours, Third Edition 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.