mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-04-06 06:43:47 +00:00
Initial commit
This commit is contained in:
parent
db1136abc1
commit
69eacee2fc
6 changed files with 38 additions and 28 deletions
|
|
@ -1,29 +1,34 @@
|
|||
namespace Packt.Shared;
|
||||
|
||||
public class BusinessClassPassenger
|
||||
public class Passenger
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
|
||||
public class BusinessClassPassenger : Passenger
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return "Business Class";
|
||||
return $"Business Class: {Name}";
|
||||
}
|
||||
}
|
||||
|
||||
public class FirstClassPassenger
|
||||
public class FirstClassPassenger : Passenger
|
||||
{
|
||||
public int AirMiles { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"First Class with {AirMiles:N0} air miles";
|
||||
return $"First Class with {AirMiles:N0} air miles: {Name}";
|
||||
}
|
||||
}
|
||||
|
||||
public class CoachClassPassenger
|
||||
public class CoachClassPassenger : Passenger
|
||||
{
|
||||
public double CarryOnKG { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Coach Class with {CarryOnKG:N2} KG carry on";
|
||||
return $"Coach Class with {CarryOnKG:N2} KG carry on: {Name}";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public partial class Person
|
|||
if (married) return;
|
||||
spouse = partner;
|
||||
married = true;
|
||||
partner.Marry(this);
|
||||
partner.Marry(this); // this is the current object
|
||||
}
|
||||
|
||||
// static method to "multiply"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue