0
Why constructors cannot be inherited?
Why in java language we can't inherited the contractors in child class
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/
+ 2
Can it be because Java classes have a default constructor in case one doesn't exist?
+ 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.
0
We can inherited if we use super yeah?
But we can't inherited without use super so why?
0
When i searched in google someone said "It will allow the construction of unsafe programs".. So is this correct?