In the context of method overriding, what is the role of the super() function?

  • It calls the base class constructor
  • It calls the derived class constructor
  • It invokes the parent class method
  • It's used to create a new instance of the class
The super() function is used to invoke the method of the parent class. It's commonly used in method overriding to call the parent class's method while adding or modifying functionality in the derived class method.
Add your answer
Loading...

Leave a comment

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