09/03/18 23:35:34
>>202
こういう感じです
派生クラスでメソッドを書き直すしかないですか?
public class A{
int x = 10;
public MethodA(){
Console.WriteLine("ここに表示される値を変えたい→ " + x);
}
}
public class B : A{
new int x = 20;
}
public class DEMO{
public static void Main(){
B b = new B();
b.MethodA(); //ここで20と表示したい
}
}