Код: Выделить всё
public class Garage {
public bool AddCar(Car car) { //omitted for brevity
}
}
Теперь вы хотите ввести его в класс автомобиля:
Код: Выделить всё
public class Car(Garage g1) {
private readonly Garage g1= g1;
public bool ModifyCarAndStoreInGarage(Car car)
// modify car properties
g1.AddCar(car);
}
}
Есть ли последовательность?>
Подробнее здесь: https://stackoverflow.com/questions/796 ... rp-classes
Мобильная версия