+ 7

What is the use of super keyword ?

19th Feb 2018, 3:17 AM
Ruchit Porwal
Ruchit Porwal - avatar
4 Answers
19th Feb 2018, 3:31 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
It's basically just to access the super class of a class if it is inheriting from another class. For example, if you were to have a class Animals with a class inheriting from it known as Dog, Dog would be the subclass of Animals and Animals would be the superclass of Dogs. The super keyword being used in the Dogs class will access the Animals class. Hope this helped!
19th Feb 2018, 3:26 AM
Faisal
Faisal - avatar
+ 4
It is used to pass values to the super class and to access its variables or methods using it's subclass.
20th Feb 2018, 1:16 AM
Sujal Kumar
Sujal Kumar - avatar