Beispiel #1
0
        public static void Main(string[] args)
        {
            var dozer  = new BullDozer("Yellow", "Mini");
            var dozer2 = new BullDozer("Red", "Medium");


            Console.WriteLine("My bulldozer1 is " + dozer.Colour + "its size is " + dozer.Tamano);
            Console.WriteLine("My bulldozer2 is " + dozer2.Colour + "Its size is " + dozer2.Tamano);
        }
        public static void Main(string[] args)
        {
            /* Instantiate the BullDozer class.
             * Make a copy of the blueprint for each dozer */
            var dozer = new BullDozer("Yellow", "Mini");

            var dozer2 = new BullDozer("Red", "Large");


            Console.WriteLine("Bulldozer is: " + dozer.color);
            Console.WriteLine("Bulldozer2 is: " + dozer2.color);
        }
        public static void Main(string[] args)
        {
            var dozer = new BullDozer {
                "Yellow", "mini"
            };

            var dozer = new BullDozer {
                "Red", "Large"
            };

            Console.WriteLine("Bulldozer 1 is: " + dozer.color);
            Console.WriteLine("Bulldozer 2 is: " + dozer2.color);
        }
Beispiel #4
0
        public static void Main(string[] args)
        {
            //create new dozer
            var dozer = new BullDozer("Yellow", "Mini");
            //can get rid of these lines below because of the constructor in the class BullDozer
            //dozer.color = "Yellow";
            //dozer.size = "mini";

            var dozer2 = new BullDozer("Red", "Large");

            //dozer.color = "Red";
            //dozer.size = "large";

            Console.WriteLine("BullDozer 1 is: " + dozer.color);
            Console.WriteLine("BullDozer 2 is: " + dozer2.color);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            //Instantiating the BullDozer Class
            //The constructor in the Bulldozer class allows us to set the size and color properties as arguments
            var dozer = new BullDozer("Yellow", "Mini"); // This is creating a new instance of the bulldozer

            //assigning properties to the dozer
            //dozer.color = "Yellow"; //Using dot notation to set the color of this object to yellow
            //dozer.size = "Mini"; //Using dot notation to set size

            //Instantiating another bulldozer
            var dozer2 = new BullDozer("Red", "Large");

            //assigning properties to the dozer
            //dozer2.color = "Blue";
            //dozer2.size = "Large";
            Console.WriteLine("The {0} Bulldozer is {1} and the {2} Bulldozer is {3}.", dozer.size, dozer.color, dozer2.size, dozer2.color);
        }