On Sunday, 24 May 2020 at 00:51:17 UTC, Jonathan M Davis wrote:
On Saturday, May 23, 2020 4:43:04 PM MDT Tim via Digitalmars-d-learn wrote:
It is but I want to make sure for other cases in the future where I create a new class that inherits from GameObject. This was I can avoid future bugs by ensure that all classes in the future that inherit from GameObject, call it's constructor

The base class constructor will _always_ be called. There's no need to worry about it. Even if you hadn't declared one, the compiler will provide a default constructor, because classes have to have a constructor. And if you had declared a constructor in your base class but no default constructor, then you'd get a compile-time error if your derived class' constructor didn't explicitly call it.

- Jonathan M Davis

Oh right. I mean it makes sense but I got confused when super() is valid syntax. Why would you need to call the super constructor when it's called automatically?

Reply via email to