Inherited is not strictly necessary if you know that the parent is a TObject. (If you look at the TObject constructor, it is empty). However, it is a bad practice, in my opinion, not to name an inherited constructor for several reasons, which I plan in a moment. But, firstly, how to call an inherited constructor like this:
constructor TEqSecGrado.Create(a, b, c: double); begin inherited Create; // Note that we need to explicitly name create here because it does not hae the same parameters as our create Self.a := a; Self.b := b; Self.c := c; delta := 0; end;
But if the inherited constructor is empty, why should we call it?
This is all that is related to maintenance, and what happens six months after we forgot what we did and why.
First, perhaps we decided to reorganize and inherit something other than TObject. If we included the inherited constructor, either it will still be valid later, or the compiler will tell us that we need to do something.
Secondly, we do not control TObject, the creators of the Delphi compiler. Perhaps in the future TObject.Create is not empty. Imagine that you need to go through all of our constructors to add an inherited one! Of course, there would be a protest from all those programmers who thought it was a waste of time, so this would never happen. Maybe.
source share