Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
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; }
    }