3.2 Using inheritance
The core idea behind inheritance is providing a way to avoid repeating code in multiple classes.
Technically, every class we create uses inheritance. All Python classes are subclasses of the built-in class named object. This class provides a little bit of metadata and a few built-in behaviors so Python can treat all objects consistently.
Inheritance requires a minimal amount of extra syntax over a basic class definition. Include the name of the parent class inside parentheses after the class name (and before the colon that follows.) This is all we have to do to tell Python that the new class should be derived from the given superclass. For more information on the syntax, see section 9.5 (https://docs.python.org/3/tutorial/classes.html#inheritance) of the Python Tutorial.
How do we apply inheritance in practice? One use of inheritance is to add functionality to an existing class. Let’s start with a contact manager that tracks...