19.1. Pillars of OOPΒΆ
Object-oriented programming involves four key ideas: encapsulation, information hiding, inheritance, and polymorphism. Encapsulation is the idea that a class can package some data together with the methods that manipulate the data. This is a powerful capability, and the chief idea that distinguishes OOP from structured programming. Information Hiding promotes quality code by allowing objects to protect their state against direct manipulation by code using the object. Python, like many languages, provides mechanisms to achieve information hiding, but we do not cover them in this book. Inheritance and polymorphism are mechanisms that help to enable code reuse and contract-based programming, and are the subject of this chapter.
You have attempted of activities on this page