Beispiel #1
0
        static void Main(string[] args)
        {
            var car1 = new SaloonCar(); // Color and Manufacturer

            car1.color        = "Red";
            car1.manufacturer = "Toyota";

            var saloonCar1 = new GeneralObject1("2");              // 2 seats

            var saloonCar2 = new Car("3", "Nissan");               // 3 seats and manufactured by Nissan

            var saloonCar3 = new SaloonCar("4", "Ford", "Purple"); // 4 seats, manufactured by Ford and color Purple
        }
Beispiel #2
0
    public static void Main(string[] args)
    {
        var car = new Car();

        car.color        = "red";
        car.manufacturer = "Toyota";

        var salCar1 = new SaloonCar(2);
        var salCar2 = new SaloonCar(3, "Nissan");
        var salCar3 = new SaloonCar(4, "Ford", "Purple");

        /*
         * Print to console to see what each object holds
         * Console.WriteLine("Saloon Car 1: " + salCar1.numberOfSeats + " " + salCar1.manufacturer + " " + salCar1.color);
         * Console.WriteLine("Saloon Car 2: " + salCar2.numberOfSeats + " " + salCar2.manufacturer + " " + salCar2.color);
         * Console.WriteLine("Saloon Car 3: " + salCar3.numberOfSeats + " " + salCar3.manufacturer + " " + salCar3.color);
         */
    }
Beispiel #3
0
        static void Main(string[] args)
        {
            var car1 = new Car();

            car1.color        = "Red";
            car1.manufacturer = "Toyota";

            Console.WriteLine(car1.color);
            Console.WriteLine(car1.manufacturer);

            var saloonCar1 = new SaloonCar(2);
            var saloonCar2 = new SaloonCar(3, "Nissan");
            var saloonCar3 = new SaloonCar(4, "Ford", "Purple");

            Console.WriteLine(saloonCar1.numOfSeats);

            Console.WriteLine(saloonCar2.numOfSeats);
            Console.WriteLine(saloonCar2.manufacturer);

            Console.WriteLine(saloonCar3.numOfSeats);
            Console.WriteLine(saloonCar3.manufacturer);
            Console.WriteLine(saloonCar3.color);
        }