static void Main(string[] args)
        {
            Octagon octagon = new Octagon();

            IDrawForm itfForm = (IDrawForm)octagon;

            itfForm.Draw();

            IDrawMemory itfMemory = (IDrawMemory)octagon;

            itfMemory.Draw();

            IDrawToPrinter itfPrinter = (IDrawToPrinter)octagon;

            itfPrinter.Draw();

            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void FunWithInterfaceNameClash_implicit()
        {
            System.Console.WriteLine("=> fun with interface name clash:");

            Octagon0 oct = new Octagon0();

            IDrawForm iform = (IDrawForm)oct;

            iform.Draw();

            IDrawInMemory iMemo = (IDrawInMemory)oct;

            iMemo.Draw();

            IDrawToPrinter iPrin = (IDrawToPrinter)oct;

            iPrin.Draw();

            Console.ReadLine();
        }