static void Main(string[] args)
        {
            Console.WriteLine("Struct Rectangle: Default constructor");
            Rectangle myRec = new Rectangle();
            myRec.Height = 10;
            myRec.Width = 200;
            Console.WriteLine("width:{0} height:{1}", myRec.Width, myRec.Height);
            ///????
            //Rectangle rect1 = new Rectangle
            //{
            //   Height = 12,
            //   Width = 15
            //};
            Console.WriteLine("Struct Rectangle: Overloaded constructor");
            RectangleV1 myRecv1 = new RectangleV1(10, 10);
            Console.WriteLine("width:{0} height:{1}", myRecv1.Width, myRecv1.Height);
            Console.ReadKey();

        }
Exemple #2
0
 static void Main(string[] args)
 {
     Console.WriteLine("Struct Rectangle: Default constructor");
     Rectangle myRec = new Rectangle();
     myRec.Height = 10;
     myRec.Width = 200;
     Console.WriteLine("width:{0} height:{1}",myRec.Width, myRec.Height);
     ///????
     //Rectangle rect1 = new Rectangle
     //{
     //   Height = 12,
     //   Width = 15
     //};
     Console.WriteLine("Struct Rectangle: Overloaded constructor");
     RectangleV1 myRecv1 = new RectangleV1(10,10);
     Console.WriteLine("width:{0} height:{1}", myRecv1.Width, myRecv1.Height);
     Console.ReadKey();
 }