I am fairly new to c++ and now trying to solve the following problem: There are two user defined classes in separate files. I want to access the members of the instantiating class (Master) from one of its members (MyObject). So in this example I want to access the other_member_ variable from the my_object instance:
Master class definition:
//master.h
#include "myobject.h"
class Master
{
// ...
public:
MyObject* my_object_ = new MyObject(this);
int other_member_;
// ...
}
And "member class" definition:
//myobject.h
#include "master.h"
class MyObject
{
// ...
public:
MyObject(Master* parent);
// ...
}
How can I do this without having the include loop etc.?