void Wagon() { passengerWagons = new List <IPassengerWagon>(); IPassengerWagon passengerWagon = new PassengerWagon(1, WagonTypes.Passenger, PassengerWagonTypes.Interregional, passenger, 10, 8); passengerWagons.Add(passengerWagon); passengerWagon = new PassengerWagon(2, WagonTypes.Passenger, PassengerWagonTypes.EconomClass, passenger, 20, 15); passengerWagons.Add(passengerWagon); passengerWagon = new PassengerWagon(3, WagonTypes.Passenger, PassengerWagonTypes.Сompartment, passenger, 15, 13); passengerWagons.Add(passengerWagon); train = new Train.Сlasses.Train(new Locomotive(), passengerWagons); Console.WriteLine(train.CountPassengers()); Console.WriteLine(train.CountBaggage()); List <IPassengerWagon> qw = train.Wagons as List <IPassengerWagon>; }