我在c#中实现如下代码:
using System;
namespace HelloWorldApplication
{
class A{
public string s = "1";
public string getS(){ return this.s;}
}
class B:A{
public new string s = "a";
}
class HelloWorld
{
static void Main(string[] args)
{
/* 我的第一个 C# 程序*/
B a = new B();
Console.WriteLine(a.getS());
Console.ReadKey();
}
}
}
上面代码运行的结果始终是"1",我如何能让运行结果变成"a"
在父类的方法中我如何能调用到子类的属性?