// Gender.cs
public enum Gender
{
Male,
Female,
}
// Person.cs
public class Person
{
public string name;
public DateTime birthday;
public Gender gender;
public bool married;
public Person spouse;
public double money;
public Person(string name, DateTime birthday)
{
this.name = name;
this.birthday = birthday;
}
public Person(string name, DateTime birthday, Person spouse) : this(name, birthday)
{
this.married = true;
this.spouse = spouse;
}
}
// Employee.cs
public class Employee : Person
{
public Manager manager;
public Employee(string name, DateTime birthday, Person spouse, Manager manager) : base(name, birthday, spouse)
{
this.manager = manager;
}
public void Pay(double amount)
{
this.money += amount;
}
}
// Manager.cs
public class Manager : Employee
{
public Director director;
public Manager(string name, DateTime birthday, Person spouse, Director director) : base(name, birthday, this, director)
{
this.director = director;
}
public void Bonus(double amount)
{
// a 25% bonus
Pay(amount + (0.25 * amount);
}
}
// Director.cs
public class Director : Manager
{
public VP vp;
public Director(string name, DateTime birthday, Person spouse, VP president) : base(name, birthday, spouse, this, vp)
{
this.vp = vp;
}
public string Report()
{
// get todays report
return "Today's report is: Foo";
}
}
// VP.cs
public class VP : Director
{
public President president;
public VP(string name, DateTime birthday, Person spouse, President president) : base(name, birthday, spouse, president)
{
this.president = president;
}
public void CallThePresident()
{
Console.Writeline(president.Call());
}
}
// President.cs
public class President : VP
{
public string companyName;
public President(string name, DateTime birthday, Person spouse, string companyName) : base(name, birthday, spouse, this)
{
this.companyName = companyName;
}
public string Call()
{
return "Hello, this had better be an emergency!";
}
}
I hope that This is what you are looking for, as I tried to make this a straight forward as possible.