Python - Class Inheritance

> Procedural Languages > Python > Python - Data Type

1 - About

Advertising

3 - Management

3.1 - Creation

3.1.1 - Class keyword

class DerivedClass(BaseClass)

where:

  • the derived class is the new class
  • and the base class is the class from which that new class inherits.

3.1.2 - Dynamic

3.2 - Access

To directly access the attributes or methods of a superclass, use the built-in super function.

class DerivedClass(Base):
   def some_method(self):
       super(DerivedClass, self).methode()

where:

  • meth() is a method from the base class.
Advertising