예제 #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;
    }
예제 #2
0
 public Human(string name, Human father = null, Human mother = null)
 {
   Name = name;
   Father = father;
   Mother = mother;
 }
예제 #3
0
 public Human(string name, Human father = null, Human mother = null)
 {
     Name   = name;
     Father = father;
     Mother = mother;
 }