Chapter 8. Inheritance and Virtual Methods

In the Chapter 7, “Classes,” you learned that encapsulating class data and methods together means that the rest of a program can concentrate on using that class. You learned that by using classes, you can implement abstract data types (ADTs), which present an interface to the classes' clients. You can combine different classes together to build up new classes.

This chapter discusses inheritance, which is another powerful way to build families of related classes (that is, class hierarchies). You use these class hierarchies to model a problem. C++ objects can carry runtime type information (RTTI), which makes true object-oriented programming possible.

In this chapter you will learn

  • How to create new classes by using inheritance

  • How to initialize member objects and references

  • How to use virtual methods

  • How to do dynamic typecasting

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.80.101