[Solved] Class which shows relationship of members in a family [closed]


Object oriented + Inheritence can help you. I think you mean this structure:

class Person
{};

class Father : public Person
{};

class Mother : public Person
{};

class Child : public Father, public Mother
{};

class Son : public Child
{};

class Daughter: public Child
{};

class Family
{
  Father father;
  Mother mother;
  std::vector<Child> children;
};

 

              +------------------+               
              |       Person     |               
              +------------------+               
                ^             ^                  
                |             |                  
                |             |                  
                \             \                  
 +------------------+      +------------------+  
 |     Father       |      |     Mother       |  
 +------------------+      +------------------+  
                 ^            ^                  
                 |            |                  
                 |            |                  
                 |            |                  
                 \            \                  
              +------------------+               
              |     Child        |               
              +------------------+               
                 ^           ^                   
                 |           |                   
                 |           |                   
                 \           \                   
 +------------------+      +------------------+  
 |     Son          |      |    Daughter      |  
 +------------------+      +------------------+  

1

solved Class which shows relationship of members in a family [closed]