Question
Q. Explain how to invoke a superclass method from a subclass method for the case in which the subclass method overrides a superclass method and
Q. Explain how to invoke a superclass method from a subclass method for the case in which the subclass method overrides a superclass method and the case in which the subclass method does not override a superclass method. [1 Mark]
this is a correct answer but i want answer it in different way :
-
In the case where the subclass method overrides the superclass method, it is necessary to explicitly use the keyword super, to invoke the method of the superclass as super.methodName().
When the subclass method does not override the superclass method, the superclass method can be invoked simply by using its name and appropriate arguments.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started