Inheritance in Python:: Terminologies
Inheritance in Python:: Terminologies
Terminologies:
Superclass or parent class: the existing class.
Subclass or child class: the class inherits the superclass.
Syntax:
class ParentClass:
class ChildClass(ParentClass):
…
ex:
types :
1) single inheritance:
When a child class inherits from only one parent class.
Ex:
2) MULTIPLE INHERITANCE:
When a class is derived from more than one base class.
Syntax: Class Base1:
Body of the class
Class Base2:
Body of the class
Class Derived(Base1, Base2):
Body of the class
Ex: