Is it possible to override a constructor in C#?
Is it possible to override the constructor of the base class in the derived class?
If so, the how can it be accomplished and in what use case would this be practical? If not, why not?
Solution 1:
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).
Solution 2:
No, Constructors are not inherited. You can not override them in derived class.
Reason
A base constructor will always be called, for every class that descends from object, because every class must have at least one constructor that calls a base() constructor (explicitly or implicitly) and every call to a this() constructor must ultimately call a base() constructor.
Solution 3:
No, you can't override the constructor.
If you take a look at the basic syntax of a constructor, it should have the same name as the class you are writing it for.
Lets say,you write a method with the same name as that of the base class(same as that of base class constructor), its just gonna be a new method in the derived class without return type specified, which is syntactically incorrect.