If a derived class does not have its constructor, which constructor gets called when an object of the derived class is instantiated?

  • Base class constructor
  • Derived class constructor
  • Python automatically creates a default constructor for the derived class.
  • There is an error and no constructor is called.
If the derived class does not have its constructor, the base class constructor is called when an object of the derived class is instantiated. It's important to remember that if the base class constructor has parameters, you must explicitly call it in the derived class's constructor using super().init() to ensure proper initialization.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *