Beispiel #1
0
        static void Main(string[] args)
        {
            Model.Rectangle r1 = new Model.Rectangle();
            int             height = -5, width = 180;
            string          color = "Blue";

            r1.setHeight(height);
            r1.setWidth(width);
            r1.setColor(color);

            PrintRectangleInfo(r1);

            Model.Rectangle r2;
            r2 = r1;
            r2.setHeight(r1.getHeight() + 1);
            PrintRectangleInfo(r2);

            Model.Rectangle r3 = new Model.Rectangle();
            r3.setHeight(10);
            r1.setWidth(52);
            r1.setColor("Green");
            r2 = r3;
            PrintRectangleInfo(r2);
            PrintRectangleInfo(r3);

            Console.ReadLine();
        }
Beispiel #2
0
        static void PrintRectangleInfo(Model.Rectangle r)
        {
            Console.WriteLine(r.GetHashCode());

            Console.WriteLine("Height is " + r.getHeight());
            Console.WriteLine("Width is " + r.getWidth());
            Console.WriteLine("Color is " + r.getColor());
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Model.Rectangle r1 = new Model.Rectangle();
            Model.Rectangle r2 = new Model.Rectangle();
            int             height = 5, width = 18;
            string          color = "YelloW";

            r1.Height = height;
            r1.Width  = width;
            r1.Color  = color;
            r2.Height = 5;
            r2.Width  = 10;
            r2.Color  = "Red";


            //r2 = r1;



            Console.WriteLine(r1 == r2);

            Console.WriteLine("Height is " + r1.Height);
            Console.WriteLine("Width is " + r1.Width);
            Console.WriteLine("Color is " + r1.Color);

/*
 *          Console.WriteLine("Before r1 "+r1.GetHashCode());
 *
 *          Model.Rectangle r2;
 *          r2 = r1;
 *          r2.setHeight(r1.getHeight() + 1);
 *          Console.WriteLine("r2 is " + r1.GetHashCode());
 *
 *          Model.Rectangle r3 = new Model.Rectangle();
 *          r3.setHeight(10);
 *          Console.WriteLine("before assign r3 is " + r3.GetHashCode());
 *
 *          r2 = r3;
 *          Console.WriteLine("After assign r3 r2 is " + r2.GetHashCode());
 *          Console.WriteLine("After assign r3 is " + r3.GetHashCode());
 *          Console.WriteLine("After all assign r1 is " + r1.GetHashCode());
 *
 *          Console.WriteLine("Height is " + r1.getHeight());
 *          Console.WriteLine("Width is " + r1.getWidth());
 *          Console.WriteLine("Color is " + r1.getColor());
 *          Console.ReadLine();*/
        }