..  Copyright (C)  Stephen Schaub.  Permission is granted to copy, distribute
    and/or modify this document under the terms of the GNU Free Documentation
    License, Version 1.3 or any later version published by the Free Software
    Foundation; with Invariant Sections being Forward, Prefaces, and
    Contributor List, no Front-Cover Texts, and no Back-Cover Texts.  A copy of
    the license is included in the section entitled "GNU Free Documentation
    License".



.. index:: inheritance


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.

