..  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".

Pillars of OOP
--------------

.. index:: inheritance

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.

.. dragndrop:: pillars_of_oop_dnd
    :practice: T
    :feedback: Read the chapter on functions and try again.
    :match_1: encapsulation||| Packaging data and methods together
    :match_2: information hiding||| protecting state (data) in objects
    :match_3: inheritance||| allows code reuse 
    :match_4: polymorphism||| contract-based programming

    Drag each item to its location in a class diagram
