Skip to Main Content
Professional C++, 3rd Edition
book

Professional C++, 3rd Edition

by Marc Gregoire
September 2014
Intermediate to advanced content levelIntermediate to advanced
984 pages
25h 22m
English
Wrox
Content preview from Professional C++, 3rd Edition

Chapter 9Discovering Inheritance Techniques

  • How to extend a class through inheritance
  • How to employ inheritance to reuse code
  • How to build interactions between base classes and derived classes
  • How to use inheritance to achieve polymorphism
  • How to work with multiple inheritance
  • How to deal with unusual problems in inheritance

Please note that all the code examples for this chapter are available as a part of this chapter’s code download on the book’s website at www.wrox.com/go/proc++3e on the Download Code tab.

Without inheritance, classes would simply be data structures with associated behaviors. That alone would be a powerful improvement over procedural languages, but inheritance adds an entirely new dimension. Through inheritance, you can build new classes based on existing ones. In this way, your classes become reusable and extensible components. This chapter will teach you the different ways to leverage the power of inheritance. You will learn about the specific syntax of inheritance as well as sophisticated techniques for making the most of inheritance.

The portion of this chapter relating to polymorphism draws heavily on the spreadsheet example discussed in Chapters 7 and 8. This chapter also refers to the object-oriented methodologies described in Chapter 5. If you have not read that chapter and are unfamiliar with the theories behind inheritance, you should review Chapter 5 before continuing.

BUILDING CLASSES ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional C++, Second Edition

Professional C++, Second Edition

Marc Gregoire, Nicholas A. Solter, Scott J. Kleper
Expert C++ - Second Edition

Expert C++ - Second Edition

Marcelo Guerra Hahn, Araks Tigranyan, John Asatryan, Vardan Grigoryan, Shunguang Wu

Publisher Resources

ISBN: 9781118858134Purchase book