天天看點

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();
    }
}      
抽象類實作
抽象類實作
抽象類實作