Beispiel #1
0
 static void Main(string[] args)
 {
     Square s = new Square(20);
     Rectangle rect = (Rectangle)s;
     Console.WriteLine("Rectangle Length: {0}, Height: {1}", rect.length, rect.height);
     Console.ReadLine();
 }
Beispiel #2
0
        private static void CustomConversion()
        {
            //Rectangle r = new Rectangle(20, 10);
            //Square s = (Square)r;
            Square s = new Square(20);
            Rectangle rect = s;
            Console.WriteLine("Rectangle Length: {0}, Height: {1}", rect.length, rect.height);
            //Console.WriteLine("Square: {0}", s.side);

        }