Beispiel #1
0
        static void CarTester()
        {
            Car sarahsCar;

            sarahsCar = new Car("white", "Ford", "Focus");

            Car emilsCar;

            emilsCar = new Car("gray", "Mercury", "Cougar");

            Console.WriteLine(emilsCar.Describe());
            Console.WriteLine("Trying to call the set color property...");
            emilsCar.Color = "purple";

            Console.WriteLine("Now, showing the new function I wrote to change color...");
            emilsCar.Paint("purple");

            Console.WriteLine("After calling the Paint method we have...");
            Console.WriteLine(emilsCar.Describe());

            Console.WriteLine("Changing the make...");
            emilsCar.Make = "Ford";

            Console.WriteLine(emilsCar.Describe());

            SportsCar joesCar;

            joesCar = new SportsCar("red", "Nissan", "Sentra", "leather");
            Console.WriteLine(joesCar.Describe());

            return;
        }
Beispiel #2
0
        static void CarTester()
        {
            Car sarahsCar;
            sarahsCar = new Car("white", "Ford", "Focus");

            Car emilsCar;
            emilsCar = new Car("gray", "Mercury", "Cougar");

            Console.WriteLine(emilsCar.Describe());
            Console.WriteLine("Trying to call the set color property...");
            emilsCar.Color = "purple";

            Console.WriteLine("Now, showing the new function I wrote to change color...");
            emilsCar.Paint("purple");

            Console.WriteLine("After calling the Paint method we have...");
            Console.WriteLine(emilsCar.Describe());

            Console.WriteLine("Changing the make...");
            emilsCar.Make = "Ford";

            Console.WriteLine(emilsCar.Describe());

            SportsCar joesCar;
            joesCar = new SportsCar("red", "Nissan", "Sentra", "leather");
            Console.WriteLine(joesCar.Describe());

            return;
        }