public bool Equals(Airline flight2) { if ( (this.Destination == flight2.Destination) && (this.PlaneType == flight2.PlaneType) && (this.DepatureTime == flight2.DepatureTime) && (this.DayOfTheWeek == flight2.DayOfTheWeek) ) { return(true); } else { return(false); } }
static void Main(string[] args) { Airline flight1 = new Airline("NYC", "Airbus 300", "19:00", "Sat"); flight1.FlightInfo(); Airline flight2 = new Airline("OSK", "Boeing 777", "12:00", "Sun"); flight2.FlightInfo(); Airline flight3 = new Airline("DMD", "Boeing 737", "22:00", "Mon"); flight3.FlightInfo(); flight1.DestinationProp = "KMP"; flight1.FlightInfo(); flight1.ReturnId(); flight1.ReturnQty(); Console.WriteLine(flight2.Equals(flight1)); Console.ReadLine(); }