Exemple #1
0
        static void Main(string[] args)
        {
            Person p1 = new Person("Ira", 1959);
            Person p2 = new Person("Kolya", 1955);
            Person p3 = new Person("Valera", 1956);
            Person p4 = new Person("Janna", 1955);
            Person p5 = new Person("Vika", 1984);
            Person p6 = new Person("Yura", 1985);
            Person p7 = new Person("Timur", 2016);

            p7.AddParents(p5, p6);
            p5.AddParents(p3, p4);
            p6.AddParents(p1, p2);

            p6.AddHeritors(p7);
            p5.AddHeritors(p7);
            p1.AddHeritors(p6);
            p2.AddHeritors(p6);
            p3.AddHeritors(p5);
            p4.AddHeritors(p5);

            p1.ShowHeritors();
            p2.ShowHeritors();
            p3.ShowHeritors();
            p4.ShowHeritors();
            p5.ShowHeritors();
            p6.ShowHeritors();

            p5.ShowParents();
            p6.ShowParents();
            p7.ShowParents();
        }