mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
35 lines
623 B
C#
35 lines
623 B
C#
namespace Packt.Shared;
|
|
|
|
public class Passenger
|
|
{
|
|
public string? Name { get; set; }
|
|
}
|
|
|
|
public class BusinessClassPassenger : Passenger
|
|
{
|
|
public override string ToString()
|
|
{
|
|
return $"Business Class: {Name}";
|
|
}
|
|
}
|
|
|
|
public class FirstClassPassenger : Passenger
|
|
{
|
|
public int AirMiles { get; set; }
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"First Class with {AirMiles:N0} air miles: {Name}";
|
|
}
|
|
}
|
|
|
|
public class CoachClassPassenger : Passenger
|
|
{
|
|
public double CarryOnKG { get; set; }
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"Coach Class with {CarryOnKG:N2} KG carry on: {Name}";
|
|
}
|
|
}
|