public static int Main(string[] args)
        {
            SuperImage si = new SuperImage();

            // Get IDraw.
            IDraw itfDraw = (IDraw)si;

            itfDraw.Draw();

            // Now get IDraw3.
            if (itfDraw is IDraw3)
            {
                IDraw3 itfDraw3 = (IDraw3)itfDraw;
                itfDraw3.DrawToMetaFile();
                itfDraw3.DrawToPrinter();
            }

            JBCar j = new JBCar();

            if (j is IJamesBondCar)
            {
                ((IJamesBondCar)j).Drive();
                ((IJamesBondCar)j).TurboBoost();
                ((IJamesBondCar)j).Dive();
            }

            return(0);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("***** Fun with Interface Inheritance *****");
            Console.WriteLine("\n-> Using SuperImage");
            SuperImage si = new SuperImage();

            // Get IDrawable.
            IDrawable itfDraw = (IDrawable)si;

            itfDraw.Draw();

            // Now get IMetaFileRender which exposes all methods up
            // the chain of inheritance.
            if (itfDraw is IMetaFileRender)
            {
                IMetaFileRender itfMF = (IMetaFileRender)itfDraw;
                itfMF.Render();
                itfMF.Print();
            }

            Console.WriteLine("\n-> Using JamesBondCar");
            JamesBondCar j = new JamesBondCar();

            j.Drive();
            j.TurboBoost();
            j.Dive();


            Console.ReadLine();
        }