public class A{
List m;
public A(int a, int b) {m=new List(); ...}
}
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!
It sounds to me that you simply have the dependency backwards mentally. I think what you want to do is this: