Пример #1
0
        static void Main(string[] args)
        {
            Circle circle = new Circle();
            circle.Name = "My Circle";
            circle.Draw();

            Square square = new Square();
            square.Name = "My Square";
            square.Draw();

            //create a list collection for drawing objects
            List<DrawingObject> drawingObjects = new List<DrawingObject>();
            //add objects to list
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());

            //loop collection and draw objects
            Console.WriteLine("Drawing objects in a list: ");
            foreach(DrawingObject drawingObject in drawingObjects)
            {
                drawingObject.Draw();
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //  DrawingObject do = new DrawingObject();

            Circle circle = new Circle();
            circle.Name = "My circle";
            circle.Draw();

            Square square = new Square();
            square.Name = "My Square";
            square.Draw();

            // Create a List collection for Drawing Objects

            List<DrawingObject> drawingObjects = new List<DrawingObject>();
            //add few objects to collection
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());

            // loop collection and draw objects
            Console.WriteLine("Drawing objects in a List: ");
            foreach(DrawingObject drawingObject in drawingObjects)
            {
                drawingObject.Draw();
            }



            Console.ReadLine();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Circle circle = new Circle();
            circle.Name = "My Circle";
            circle.Draw();

            Square square = new Square();
            square.Name = "My Square";
            square.Draw();

            //create list collections for Drawing Objects
            List<Drawing_object> drawingObjects = new List<Drawing_object>();
            // add new object to collection
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());

            //loop collection and draw objects
            Console.WriteLine("Drawing objects in a List:");
            foreach (Drawing_object drawingObject in drawingObjects) ;
            {
                circle.Draw();
            }

        }
Пример #4
0
        static void Main(string[] args)
        {
            //DrawingObject do = new DrawingObject();
            Circle circle = new Circle();
            circle.Name = "My Circle";
            circle.Draw();

            Square square = new Square();
            square.Name = "My Square";
            square.Draw();

            //Create a list collection for Drawing Objects

            List<DrawingObject> drawingObjects = new List<DrawingObject>();

            //Add new objects to collection

            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            
            //Loop collection and draw objects

            Console.WriteLine("\nDrawing objects in a list:");
            Console.ReadLine();
            foreach(DrawingObject DrawingObject in drawingObjects)
            {
                DrawingObject.Draw();
            }


            Console.WriteLine("Press any key to continue...");
            Console.ReadLine();


        }
Пример #5
0
        static void Main(string[] args)
        {
            //DrawingObject do = new DrawingObject();
            Circle circle = new Circle();

            circle.Name = "My Circle";
            circle.Draw();

            Square square = new Square();

            square.Name = "My Square";
            square.Draw();

            //Create a list collection for Drawing Objects

            List <DrawingObject> drawingObjects = new List <DrawingObject>();

            //Add new objects to collection

            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());

            //Loop collection and draw objects

            Console.WriteLine("\nDrawing objects in a list:");
            Console.ReadLine();
            foreach (DrawingObject DrawingObject in drawingObjects)
            {
                DrawingObject.Draw();
            }


            Console.WriteLine("Press any key to continue...");
            Console.ReadLine();
        }
Пример #6
0
        static void Main(string[] args)
        {
            //  DrawingObject do = new DrawingObject();

            Circle circle = new Circle();

            circle.Name = "My circle";
            circle.Draw();

            Square square = new Square();

            square.Name = "My Square";
            square.Draw();

            // Create a List collection for Drawing Objects

            List <DrawingObject> drawingObjects = new List <DrawingObject>();

            //add few objects to collection
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Square());

            // loop collection and draw objects
            Console.WriteLine("Drawing objects in a List: ");
            foreach (DrawingObject drawingObject in drawingObjects)
            {
                drawingObject.Draw();
            }



            Console.ReadLine();
        }