![]() |
VOOZH | about |
The super keyword is used to call the parent class's constructor to access its properties and methods.
super(arguments);
super.parentMethod(arguments);
This keyword can accepts all the arguments that has been used to create a constructor.
Example: The code defines Person and FashionDesigner classes, where FashionDesigner extends Person. The person has methods for work, home, and sleep states. FashionDesigner adds a profession method and a combined task method. An instance of FashionDesigner is created, and its methods' outputs are displayed using a display function.
Sayan is a Fashion Designer Sayan is at home Sayan is at work, Sayan is a Fashion Designer