Exemple #1
0
        static void Main(string[] args)
        {
            //create an instance of the car
            Car myCar = new Car();
            //set up the properties
            myCar.Make = "BMW";
            myCar.Model = "1000";
            myCar.Color = "Black";
            myCar.Year = 2010;

            //call the helper method printCarDetails
            printCarDetails(myCar);

            Truck myTruck = new Truck();
            myTruck.Make = "Ford";
            myTruck.Model = "F950";
            myTruck.Color = "Blue";
            myTruck.Year = 1998;
            myTruck.TowingCapcity = 1200;

            printCarDetails(myTruck);
            Console.ReadLine();
        }
Exemple #2
0
 //define a helper method
 private static void printCarDetails(Car car)
 {
     Console.WriteLine("Here is the details of the Car: {0}", car.FormatMe());
 }