Dear all, Consider the following code:
class Person
{
Person *parent;
public:
Person(Person *p){parent = p;}
};
int main()
{
Person grandfather(nullptr);
Person father(&grandfather);
Person son(&father);
// Do something here
return 0;
}
The inter-object relationship works fine, as long as I don't pass the objects around as function arguments (e.g. pass by value) or clone the objects. If I want to pass them as function parameters, or make a clone of the three objects, without breaking their relationships, what should I do? Thanks. Milan.