Python Inheritance Types

Main advantage of python inheritance is code re-usability. The members of the super class are reusable in the sub classes. Let's remember that all classes in Python are built from a single super class called 'object'.

If a programmer creates his own classes, by default object class will become super class for them internally. This is the reason, sometimes while creating any new class, we mention the object class name in parentheses as:

class Myclass(object):

Here, we are indicating that object is the super class for Myclass. Of course, writing object class name is not mandatory and hence the preceding code is equivalent to writing:

class Myclass:

Inheritance types:

Now, coming to the types of inheritance, there are mainly 2 types of inheritance available.

  1. Single inheritance
  2. Multiple inheritance