Exemple #1
0
        static void Main(string[] args)
        {
            Honda  honda  = new Honda("Accord", "Nikita", 10);
            ClassA classa = new ClassA();

            classa.Method(honda);
            Car car = honda;

            classa.Method(car);
            Car car1 = new Car("Boris");

            classa.Method(car1);
        }
Exemple #2
0
 public void Method(Honda car)
 {
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine();
     if (car.Owner != null)
     {
         Console.WriteLine("Car owner is: " + car.Owner);
     }
     if (car.Age != default)
     {
         Console.WriteLine("Age of car: " + car.Age);
     }
     if (car.Model != null)
     {
         Console.WriteLine("Model of Honda: " + car.Model);
     }
 }