How to call constructor of the current class and parent class at the same time?
- by Siegfried
public class A{
public A(int a, int b) {...}
}
public class B : A{
List a;
List b;
public B(){...} //constructor1
public B(int a, int b) : base(a,b){...} //constructor2
}
My question is I need to initialize both list a and b in class B. If I put them in the constructor1, how can I call constructor1 in constructor2? I don't want to rewrite the initialization statements in constructor2 again. Thanks!