18: Inheritance

Think Python 2ed. · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC 3.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    18: Inheritance

    The language feature most often associated with object-oriented programming is inheritance. Inheritance is the ability to define a new class that is a modified version of an existing class. In this chapter I demonstrate inheritance using classes that represent playing cards, decks of cards, and poker hands.

    If you don’t play poker, you can read about it at http://en.Wikipedia.org/wiki/Poker, but you don’t have to; I’ll tell you what you need to know for the exercises.

    Code examples from this chapter are available from http://thinkpython2.com/code/Card.py.


    This page titled 18: Inheritance was last modified on Tue, 01 Dec 2020 03:30:44 GMT and is shared under a CC BY-NC 3.0 license and was authored, remixed, and/or curated by Allen B. Downey (Green Tea Press) via source content that was edited to the style and standards of the LibreTexts platform.