Ejemplo n.º 1
0
        static void UseImplicit()
        {
            StreamReader stream = new StreamReader(new MemoryStream());

            var   text  = new TextClass();
            Shape shape = text;

            text.Hieght = 200;
            shape.Width = 100;

            Console.WriteLine(text.Width);
        }
Ejemplo n.º 2
0
        static void UseExplicit()
        {
            Shape     shape = new TextClass();
            TextClass text  = (TextClass)shape;

            var x = shape as TextClass;

            if (x != null)
            {
                Console.WriteLine("Up casting method!");
            }
        }