Is it compulsory to present a constructor in base class with 0 argument
public class myBaseClass
{
public myBaseClass()
{
code
}
public myBaseClass(int age)
{
code
}
}
public class myDerivedClass : myBaseClass
{
public myDerivedClass()
{
code
}
public myDerivedClass(int age)
{
code
}
}
myDerivedClass obj = new myDerivedClass();
This is original code. If I make comment to base class constructor without argument i.e.
/*public myBaseClass()
{
code
}*/
and now run the same code , error comes "No overload for method 'myBaseClass' takes '0' arguments"
Why? Is it compulsory that if any constructor is present with one parameter in base class, then constructor with 0 arguments should also be present.