Index Ai Academy
Glossary · Phase 0 · Tools

Subclass

Also written: subclasses

A class built on another class with inheritance, such as class Rental(Product).

class Rental(Product): makes Rental a subclass of Product: it gets every attribute and method Product has. Product is the parent 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.

Start this free lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write