On the most basic level, I need a method from a class to access private data from another class, such as:
foo.h:
class foo{
void method( void );
}
bar.h:
class bar{
friend void foo::method( void );
}
However, method needs to know which object to be accessing, making it look more like this:
foo.h:
class foo{
void method(bar* point);
}
bar.h:
class bar{
friend void foo::method(bar* point);
}
However, as you can see this gives cyclical dependency: bar would need foo.h for declaring a friend, and foo would need bar.h as it uses a bar pointer. How else would the method know which object to access?