Your design assumes that a child has a parent (the child could be an orphan). Your design also assumes that the parent and child have the same surname and address; this is not always the case.
If you are attempting to define a family tree, then obviously the parent's are children of other parents.
Anyhow, your design is ok if you are merely attempting a loose association between two objects.
How about something like:
Code:
class Address
{
std::string street;
std::string city;
std::string country;
...
};
class Person
{
std::string firstName;
std::string lastName;
...
};
class Parent : public Person
{
Address addr;
std::vector<Child*> children;
...
};
class Child : public Person
{
Address addr;
Parent* parents[2];
...
};
I did not put too much thought into the design above, but basically everyone has an Address and is a Person. Parents have 0 or more Child(ren), and Child(ren) has two Parents.
P.S. Perhaps Parent should be a sub-class of Child?