Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Human
- {
- public int fullAge;
- public string firstName;
- public string secondName;
- public string gender;
- public void getHumanInfo()
- {
- Console.WriteLine($"This human name is {firstName} {secondName}.");
- if (gender == "woman")
- {
- Console.WriteLine($"She is a {fullAge} years old");
- }
- else if (gender == "man")
- {
- Console.WriteLine($"He is a {fullAge} years old");
- }
- else
- Console.WriteLine($"Gender is indefined. It is a {fullAge} years old");
- }
- }
- class Teacher : Human
- {
- public int experience;
- public int hoursInWeek;
- public string subject;
- private float salary;
- }
- class Pupil : Human
- {
- public int form;
- public char formLetter;
- }
- class Parent : Human
- {
- private int howMuchCldr;
- private float salary;
- }
- class Worker : Teacher
- {
- public string position;
- }
- class Program
- {
- static void Main(string[] args)
- {
- Human Alisa = new Human();
- Alisa.firstName = "Alisa";
- Alisa.secondName = "Beznis";
- Alisa.gender = "woman";
- Alisa.fullAge = 15;
- Alisa.getHumanInfo();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement