-1

When we create a new derived class is it considered as an instance of the base class? the derived class will have all the functions and attribute that any instance of the base class have.

  • 4
    Inheritance means IS-A. The Liskov Substitution principle means a child B can be used anywhere a parent A is required. – duffymo Jan 20 '19 at 22:36
  • 3
    The derived class itself is not an instance of its base class. Instances of the derived class are instances of the base class. – khelwood Jan 20 '19 at 22:37
  • 1
    Regarding the second part of your question: https://stackoverflow.com/questions/6396452/python-derived-class-and-base-class-attributes#6396839 – metatoaster Jan 20 '19 at 22:40

1 Answers1

4
  • The derived class is usually called a subclass of the base class(es).

  • Instances of the derived class are also instances of the base class(es).

  • The derived class is not an instance of the base class, but it is an instance of the base class metaclass, unless the derived class overrides the metaclass.

wim
  • 338,267
  • 99
  • 616
  • 750