0

why the constructor of super class is executed when we create object of sub class?

Please explain the reason...

21st Sep 2016, 9:08 AM
Pradeep Saini
Pradeep Saini - avatar
3 odpowiedzi
+ 1
no constructor no super class no super class no sub class
21st Sep 2016, 12:10 PM
doding
doding - avatar
+ 1
in the inheritance all the base class variables and methods are available to the derived class so when you create object of the derived class, base class and derived class constructors executed. similarly father's property can access by his son by default.
16th Nov 2016, 1:10 PM
Pampanagouda Karmanchi
Pampanagouda Karmanchi - avatar
+ 1
Constructors get initialized when their class object is created. When we inherit(extends) a class with DEFAULT constructor, the constructor gets automatically TRIGGERED because it doesn't require any parameter, when its object is created, voila! You have the TRIGGERED constructor executed
19th Nov 2016, 3:30 PM
Danish Khan
Danish Khan - avatar