+ 2
Methods in super class are inherited to child class. But for parameter constructors why we are using super keyword in sub class.
Why they are not inherited automatically as like normal methods
2 Respostas
+ 1
Parent class contain default constructor and parameter constructor .child class contain default and parameter constructor .if I create object to child class constructor with parameters then it calls default constructor in parent and parameter constructor in child class .why it doesn't call parameter constructor in parent class .using super (parameter) in child class it calls parameter constructor of parent class
+ 1
From a practical side:
Often the child classes, besides specialized behaviour, also have additional members.
By using the 'super' you don't have to rewrite code that's gonna be the same for the children; you let the base's constructor handle what it can handle and only manually take care of the arguments that are different.