Beispiel #1
0
 public void ChangeOwner(Driver owner, string carNumber)
 {
     try { owner.OwnCar(this); }
     catch { return; }
     CarPassport.Owner = owner;
     CarNumber = carNumber;
 }
Beispiel #2
0
 static void Main()
 {
     var car = new Car("Лада", 'D') { Color = Color.DarkViolet };
     try
     {
         Console.WriteLine(car.CarPassport.Owner.Name);
     }
     catch
     {
         // ignored
     }
     var driver = new Driver("Вольдемар", 2002) { Category = "BC" };
     car.ChangeOwner(driver, "о777оо");
     driver.Category += 'D';
     car.ChangeOwner(driver, "о777оо");
     Console.WriteLine(driver.Car.CarNumber);
     Console.WriteLine(car.CarPassport.Owner.Name);
     Console.ReadKey();
 }