Why constructor can not be inherited?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Studied at the University of Vienna, Lives in Vienna, Austria.
This is one reason constructors aren't inherited. Inheritance means a derived object can use a base-class method, but, in the case of constructors, the object doesn't exist until after the constructor has done its work. I understand the constructor is called before object construction is completed.
2023-05-13 12:30:36
评论(499)
Helpful(122)
Helpful
Helpful(2)

Julian Patel
QuesHub.com delivers expert answers and knowledge to you.
This is one reason constructors aren't inherited. Inheritance means a derived object can use a base-class method, but, in the case of constructors, the object doesn't exist until after the constructor has done its work. I understand the constructor is called before object construction is completed.