-1

I want to choose a design pattern for the below case: Ancestor Tree: An ancestor tree is a special type of family trees that keeps track of all known ancestors of a person. The following is the data definition of an ancestor tree. • An empty ancestor tree is an ancestor tree.

• A non-empty ancestor tree is an ancestor tree that contains o a String representing the name of a person, o an int representing the year the person was born, o an ancestor tree for the person’s father, and o an ancestor tree for the person’s mother.

Since this looks like a behaviour pattern, will factory pattern be suited for this?

user4532954
  • 33
  • 2
  • 11

1 Answers1

1

Your description looks very similar to the Composite pattern

alex_noname
  • 9,733
  • 1
  • 9
  • 30