0

Why constructors cannot be inherited?

Why in java language we can't inherited the contractors in child class

15th May 2019, 7:15 AM
👩🏻__🇴🇲
👩🏻__🇴🇲 - avatar
5 Answers
+ 10
Were as methods and fields are inherited constructors are not have a look at this 👍 https://www.google.com/amp/s/www.geeksforgeeks.org/constructors-not-inherited-java/amp/
15th May 2019, 8:07 AM
D_Stark
D_Stark - avatar
+ 2
Can it be because Java classes have a default constructor in case one doesn't exist?
15th May 2019, 7:18 AM
Seb TheS
Seb TheS - avatar
+ 1
My (hopefully not too simplified) imagination: Base class constructor sets up the base class part of the object. Derived class constructor sets up the derived class part. Both constructors are executed. They act before you can even use an instance's members (inherited or not), they prepare the object for that use.
15th May 2019, 8:12 AM
HonFu
HonFu - avatar
0
We can inherited if we use super yeah? But we can't inherited without use super so why?
15th May 2019, 7:24 AM
👩🏻__🇴🇲
👩🏻__🇴🇲 - avatar
0
When i searched in google someone said "It will allow the construction of unsafe programs".. So is this correct?
15th May 2019, 8:21 AM
👩🏻__🇴🇲
👩🏻__🇴🇲 - avatar