Untitled
unknown
plain_text
3 years ago
1.1 kB
8
Indexable
public class Person
{
protected int yearOfBirth;
protected string? healthInfo;
protected string? name;
public Person(int yearOfBirth, string name, string healthInfo)
{
this.yearOfBirth = yearOfBirth;
this.name = name;
this.healthInfo = healthInfo;
}
public string GetHealthStatus()
{
return name + ": " + yearOfBirth + ". " + healthInfo;
}
}
public class Child : Person
{
protected string? childIDNumber;
public Child(int yearOfBirth, string name, string healthInfo, string ChildIDNumber)
: base(yearOfBirth, name, healthInfo)
{
this.childIDNumber = ChildIDNumber;
}
}
public class Adult : Person
{
public Adult(int yearOfBirth, string name, string healthInfo, string passportNumber)
: base(yearOfBirth, name, healthInfo)
{
}
public string GetHealthStatus() { return name + ": " + yearOfBirth + ". " + healthInfo; }
}Editor is loading...