Inheritance

  • Inheritance allows one class to gain the properties of another class, so that a child inherits some attributes from each of their parents.
  • Inheritance allows to create a new class that reuses the data members and methods of an existing class.
Types of inheritance in Python
Types of inheritance in Python
  • Inheritance models what is called an is a relationship. This means that when you have a Derived class that inherits from a Base class, you created a relationship where Derived is a specialized version of Base
  • Composition is a concept that models a has a relationship. It enables creating complex types by combining objects of other types. This means that a class Composite can contain an object of another class Component . This relationship means that a Composite has a Component

Questions:

SuperMade with Super