예제 #1
0
        static void Main(string[] args)
        {
            Figure rnct1 = new Rectangle();
            Point [] cont = new Point[4];
            cont[0] = new Point(1, 1, 1,"A");
            cont[1] = new Point(2, 2, 2, "B");
            cont[2] = new Point(3, 3, 3, "C");
            cont[3] = new Point(4, 4, 4, "D");
            rnct1.InsertInfo(cont);
            Console.WriteLine(rnct1);   // display info
            rnct1.WriteToFile("rectangle.txt"); // print to file
            Console.WriteLine("----------");
            IControls btn = Button.InstanceCreation();
            btn.Click();
            Console.WriteLine(btn);     // check overriden method

            // --------------------------
            Console.WriteLine("*************");
            var pnt1 = new Point(1, 1, 1);
            var pnt2 = new Point(2, 2, 2);

            Console.WriteLine(pnt1);
            Console.WriteLine(pnt2);

            var pnt3 = new Point();
            pnt3 = pnt1 + pnt2;
            Console.WriteLine("Point 1 + Point 2: {0}" , pnt3);
            pnt3 = pnt1 - pnt2;
            Console.WriteLine("Point 1 - Point 2: {0}", pnt3);
            pnt3 = pnt1 * pnt2;
            Console.WriteLine("Point 1 * Point 2: {0}", pnt3);
            Console.WriteLine("Point 1 = Point 2? {0}", pnt1 == pnt2);

            Console.ReadKey();
        }