コード例 #1
0
    public static void Main(string[] Args)
    {
        MyClass aaa = new ClassA();
        MyClass bbb = new ClassB();

        aaa.A();             // prints MyClass.A
        aaa.B();             // prints MyClass.B
        (aaa as ClassA).A(); // prints AttachmentA.A
        (aaa as ClassA).B(); // prints MyClass.B
        bbb.A();             // prints MyClass.A
        bbb.B();             // prints MyClass.B
        (bbb as ClassB).A(); // prints AttachmentB.A + MyClass.A
        (bbb as ClassB).B(); // prints AttachmentB.B
    }