I want to do something like this
public class Class1
{
public Class1()
{
}
public Class1(int a)
{
}
}
public class Class2 :Class1
{
public Class2(int a)
{
}
public Class2(): base(2)
{
this(2); // new Class2(2);
}
}
I know this can’t be achieved in Java (can use one between (super or this) in the first line)
But somehow I am in need of this kind of work how to achieve that? Means calling the base class’s parameterised and derived class’s parameterised constructor in default constructor of derived class.
MSDN article on constructors is pretty good. Here are some relevant bits:
This should work: