public void LoadCargoInto(CargoPlane intoCargoplane, int newCargo) { foreach (var airplane in airplanesList) { if (airplane is CargoPlane) { //var cargoplane = airplane as CargoPlane; var cargoplane = (CargoPlane)airplane; if (intoCargoplane.PlaneId.Equals(cargoplane.PlaneId)) { intoCargoplane.LoadCargo(newCargo); } } } }
//Operations on Cargo planes: public void AddCargoPlane(CargoPlane newCargoPlane) { airplanesList.Add(newCargoPlane); Console.WriteLine(value: $"The cargo plane with ID: {newCargoPlane.PlaneId} has been added to the {AirportName} airport.\n"); }