Exemplo n.º 1
0
    /// <summary>
    ///   grandMom <---+ +---> grandDad
    ///                | |     ^      ^
    ///                | |     |      | 
    ///                | |     |      |
    ///                Mom<--- son    |
    ///                  ^            |    
    ///                  |            |    
    ///                  +--------- daughter
    /// </summary>
    Human MakeFamily()
    {
      var grandDad = new Human("grandDad");
      var grandMom = new Human("grandMom");

      var mother = new Human("Mom", grandDad, grandMom);
      grandDad.Children.Add(mother);
      grandMom.Children.Add(mother);

      var son = new Human("son", grandDad, mother);
      grandDad.Children.Add(son);
      mother.Children.Add(son);

      var daughter = new Human("daughter", grandDad, mother);
      grandDad.Children.Add(daughter);
      mother.Children.Add(daughter);
      return mother;
    }
Exemplo n.º 2
0
 public Human(string name, Human father = null, Human mother = null)
 {
   Name = name;
   Father = father;
   Mother = mother;
 }
Exemplo n.º 3
0
 public Human(string name, Human father = null, Human mother = null)
 {
     Name   = name;
     Father = father;
     Mother = mother;
 }