Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    Your examples don't convice me. Just because you code bugs on purpose it is no valid argument against constructor inheritance. NullPointerExceptions are completely normal if you botch (and sometimes even if you don't). Commented Aug 23, 2017 at 6:30
  • @TheincredibleJan The point is that one important thing constructors are used for, is enforcing class invariants. Implicit constructor inheritance would make it much more complicated to give any guarantees about instances of a class (impossible, even, if you consider that constructors may be added to superclasses). Commented Aug 23, 2017 at 7:14
  • 1
    This is not a good example. Your problem is that you are casting non-Integer Numbers to Integer. It has nothing to do with inheritance. Commented Nov 22, 2019 at 17:31
  • @LowKeyEnergy no, the problem is that being able to bypass constructors would deprive you of the only way you have to enforce class invariants. But, I admit my example could be more succinct - the point made in the accepted answer is more to the point; that everything would have a default constructor. Commented Nov 25, 2019 at 8:14