天天看点

C# 抽象类继承接口简单测试

class IA_TEST
{
    interface ITest
    {
        void Test();
    }

    abstract class IATest : ITest
    {
        public abstract void Test();
    }

    class MyTest : IATest
    {
        public override void Test()
        {
            Console.WriteLine("抽象类实现");
        }
    }


    static void Main()
    {
        ITest test = new MyTest();
        test.Test();

        IATest iATest = new MyTest();
        iATest.Test();
        ITest test1 = iATest;
        test1.Test();

        Console.ReadKey();
    }
}      
抽象类实现
抽象类实现
抽象类实现