Chapter 4. Inheritance: Getting Something for Nothing

For the past three days, you’ve concentrated on learning about the first pillar of object-oriented programming: encapsulation. Although encapsulation is a fundamental concept in OOP, there is more to the story than supporting simple ADTs and modules. In fact, OOP would offer very little over older-style programming if all it did was offer simple encapsulation. Of course, OOP offers much more.

OOP goes further by adding two other features: inheritance and polymorphism. You will spend the next two days considering inheritance, the second pillar of OOP.

Today you will learn

  • What inheritance is

  • The different types of inheritance

  • Some of the pitfalls of inheritance

  • Tips to effective inheritance

  • How inheritance ...

Get Sams Teach Yourself Object Oriented Programming in 21 Days, Second 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.