0
Parent constructors are not called implicitly if the subclass defines a constructor.
Could you please explain me what is mean by this line??
7 Réponses
+ 3
Riya if you extend a class and create a constructor for the subclass then the compiler will not provide a default constructor.
So you now cannot implicitly call the default constructor of the base class.
+ 2
Riya see a constructor is nothing but a method which is called when an object of the class is created.
So if you have a class and do not write any constructor for the class then the compiler will provide a no argument default constructor.
Since it is not provided by you, it is called an implicitly provided constructor.
Apart from that any constructor you create is called an explicitly provided constructor. Since it is not automatically provided.
0
Avinesh thanks please can u explain what is mean by implicitly & explicitly in terms of inheritance
0
Thanks Avinesh
0
Ok rodwynnejones thanks for suggestion
0
Hi