On Sunday, 24 May 2020 at 06:38:46 UTC, Tim wrote:
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?
A base class with a constructor that has no args will automatically get called at the start of a child class if it is not explicitly called. You can call it yourself anywhere in an always executed branch of the constructor. As for why, if you wanted to do some logging before the base constructor was called.
You need to call the base class's constructor explicitly when it has arguments and there is no default constructor in the base class. This must be done in an always executed branch. This must be called or the compiler will issue an error.