using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 抽象类 { class Program { static void Main(string[] args) { animal a = new Dogs(); animal b = new Cats(); a.Bark(); b.Bark(); Console.ReadKey(); } public abstract class animal { public abstract void Bark(); } public class Dogs : animal { public override void Bark() { Console.WriteLine("小狗汪汪叫"); } } public class Cats : animal { public override void Bark() { Console.WriteLine("小猫喵喵叫"); } } } }