Glossary · Phase 0 · Tools
Class attribute
A value written in a class's body, outside any method, and shared by every object of that class.
Try it now
Creating the Rental runs Rental's __init__, which calls Product's __init__ through super(). Watch two frames for the same object, one stacked on the other.
Learn it properly
Inheritance and class attributes · Build classes on other classes, and share values across every object. About 35 minutes.
Other terms from the same lesson
- inheritance: Building a new class on an existing one, so it gets everything the old class has and can change or add to it.
- subclass: A class built on another class with inheritance, such as class Rental(Product).
Never trained an AI?
Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.