Is it true a derived class does not inherit base class constructor and destructor? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it true a derived class does not inherit base class constructor and destructor?

14th May 2018, 4:55 PM
Mixe
Mixe - avatar
3 Answers
+ 5
Yes, but when a subclass is instantiated, the standard behaviour is for the default constructor of the base class to be called automatically. In this way, the base constructor can initialise the base class before the subclass's constructor is executed.
14th May 2018, 7:06 PM
Rusty.Metal
+ 1
yes. constructor never become a part of child class
14th May 2018, 5:14 PM
Arun Tomar
Arun Tomar - avatar
0
that is really confusing
14th May 2018, 5:15 PM
Mixe
Mixe - avatar