ふらっとC#,C♯,C#(初心者用) Part39
■ このスレッドは過去ログ倉庫に格納されています
0209デフォルトの名無しさん
2009/03/18(水) 23:40:05これでどうだ
public class A
{
protected int x = 10;
public void MethodA()
{
Console.WriteLine("ここに表示される値を変えたい→ " + x);
}
}
public class B : A
{
public B()
{
this.x = 20;
}
}
public class DEMO
{
public static void Main()
{
B b = new B();
b.MethodA(); //ここで20と表示したい
}
}
■ このスレッドは過去ログ倉庫に格納されています