+ 3

What if I dont want the constructor of the superclass to be executed when creating an object of the subclass?

I am just curious. After all there is a reason why the class is derived..

13th Mar 2018, 11:18 AM
Adam Aksu
Adam Aksu - avatar
3 Réponses
+ 1
it is not possible just don't extend that class
16th Mar 2018, 2:30 PM
+ 1
michal What if we overload constructor? And then use that overloaded to creat subclass!
7th May 2018, 10:51 AM
Rafique Abdullah
every constructor of the subclass calls either another constructor of the subclass (but this can't go infinitely) or the constructor of superclass so the superclass's constructor will be called anyway
7th May 2018, 2:31 PM