コード例 #1
0
    static int Main()
    {
        ReallyDerived r1 = new ReallyDerived();
        Derived       r2 = r1;
        Base          r3 = r1;
        ICommon       r4 = r1;
        Object        r5 = r1;

        if (r1.DoIt() != 5)
        {
            return(1);
        }

        //		Console.WriteLine ("TEST {0}", ((ICommon)r1).DoIt ());

        if (((ICommon)r1).DoIt() != 3)
        {
            return(2);
        }

        if (r2.DoIt() != 5)
        {
            return(3);
        }

        if (r3.DoIt() != 2)
        {
            return(4);
        }

        if (r4.DoIt() != 3)
        {
            return(5);
        }

        return(0);
    }