Is it possible to override a constructor in C#?

No, you can’t override constructors. The concept makes no sense in C#, because constructors simply aren’t invoked polymorphically. You always state which class you’re trying to construct, and the arguments to the constructor.

Constructors aren’t inherited at all – but all constructors from a derived class must chain either to another constructor in the same class, or to one of the constructors in the base class. If you don’t do this explicitly, the compiler implicitly chains to the parameterless constructor of the base class (and an error occurs if that constructor doesn’t exist or is inaccessible).

Leave a Comment