June 2002
Beginner to intermediate
640 pages
14h 24m
English
Inheritance allows you to reuse common code and so has a profound effect on the way you implement your Python classes. It also allows you to organize your classes into a hierarchical arrangement. Classes toward the bottom of the hierarchy inherit from classes higher up (like a family tree). Thus, if you create a class, classB, that inherits behavior and attributes from another class, ClassA, then classB becomes the subclass of classA, and classA becomes the superclass of classB.
A subclass can override or create new behavior and attributes specific to its role. This is called specialization.
The Limits of InheritanceIt may look like one, but inheritance is no silver bullet. In fact, there are reasons to limit its use. Like all good ... |
Read now
Unlock full access