Не могу передать данные с одного конструктора класса за умолчания в другой.
Вот код первого класса в который надо передать:
internal class Airplane
{
protected string StartCity;
protected string FinishCity;
protected Date StartDate;
protected Date FinishDate;
public Airplane()
{
StartCity = "London";
FinishCity = "Lviv";
StartDate = new Date(2222,12,4,12,42);
FinishDate = new Date(2222,12,5,6,12);
}
public Airplane(string startCity, string finishCity)
{
StartCity = startCity;
FinishCity = finishCity;
}
public Airplane(Airplane obj)
{
StartCity=obj.StartCity;
FinishCity=obj.FinishCity;
StartDate = new Date(obj.StartDate);
FinishDate = new Date(obj.FinishDate);
}
}
Вот код другого класса:
internal class Date
{
protected int Year;
protected int Month;
protected int Day;
protected int Hours;
protected int Minutes;
public Date()
{
Year = 2022;
Month = 1;
Day = 11;
Hours = 12;
Minutes = 20;
}
public Date(int year, int month, int day, int hours, int minutes)
{
Year = year;
Month = month;
Day = day; ;
Hours = hours;
Minutes = minutes;
}
public Date(Date obj)
{
this.Year = obj.Year;
this.Month = obj.Month;
this.Day = obj.Day;
this.Hours = obj.Hours;
this.Minutes = obj.Minutes;
}
}