Chapter 6. Polymorphism: Learning to Predict the Future

So far, you have learned about the first two pillars of object-oriented programming: encapsulation and inheritance. As you know, encapsulation enables you to build self-contained software components and inheritance enables you to reuse and extend those components. However, there is still something missing. Software is always changing. Whether users demand new functionality, bugs appear, or software needs to be integrated into new environments, the only constant is change. The software lifecycle does not end when you ship a product. You need software that can adapt to fit future needs. Wouldn’t it be great if you could write “future proof” software?

Future proof software adapts to future requirements ...

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.