© Sloan Kelly  2019
Sloan KellyPython, PyGame, and Raspberry Pi Game Developmenthttps://doi.org/10.1007/978-1-4842-4533-0_15

15. Inheritance, Composition, and Aggregation

Sloan Kelly1 
Niagara Falls, ON, Canada
When most people learn about object-oriented programming, they learn three things:
  • Objects have attributes (data) that contain the object’s state.

  • Methods that control access (change or view) the object’s state.

  • Objects can be extended using a technique called inheritance.

There are others, but those are the three main things that people remember about their first introduction to object-oriented programming.

Most people fixate on that last one: object extension by inheritance. That’s true in a lot of cases, but there are ways that objects can ...

Get Python, PyGame, and Raspberry Pi Game Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.