Example #1
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 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();
            }

        }
Example #2
0
        static void Main(string[] args)
        {
         // DrawingObject do = new DrawingObject(); ei voi tehä
         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 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(DrawingObject drawingObject in drawingObjects)
            {
                drawingObject.Draw();
            }

            Console.WriteLine("Press enter key to continue...");
            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            //DrawingObject draw = 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 a few 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 Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());
            drawingObjects.Add(new Circle());
            drawingObjects.Add(new Square());

            //Loop collection and draw the objects
            Console.WriteLine("\nDrawing objects from the list: ");
            foreach(DrawingObject drawingObject in drawingObjects)
            {
                drawingObject.Draw();
            }

            Console.Read();
        }