I have a problem with an access from a guest class. Main class is playtable with many of variables. One of them is table of object from class player. I want to make it that way that every player could have access to any variables from class playtable. I thought about many variants, but it's always wrong. In best scenario i end with a pointer to main class playtable in EVERY object class player. I wolud like to use something more elegant especially when i have many players so i would have the same pointers many times (static is not a solution, different tables different variables)
Simplify problem:
1 2 3 4 5 6 7 8 9 10 11 12 13
class player;
class playtable
{
int fun;
player tab[8];
};
class player
{
void fun()
{
//some operations on playtable::fun
}
};