using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace abstractTest { //只要一个方法声明为:abstract,类也必须使用abstract修饰,abstract修饰的类不能实例化 public abstract class Person { //声明SayHello抽象方法 public abstract void SayHello(); } public class Chinese : Person { //子类必须实现父类的abstract方法 public override void SayHello() { //throw new NotImplementedException(); Console.WriteLine("我是中国人"); } } class Program { static void Main(string[] args) { Chinese c = new Chinese(); c.SayHello(); } } }