Here is the situation

there is

Code:
class A{
  bool managment; // this variable is initialized later after construction

  struct UserInfo
  {
     std list::groups;
     std list::rights;
  }

  struct GroupInfo
  {
    std list::rights;
  }

  UserInfo users[];
  std::map<string,GroupInfo> groups;
}
Now in case managment is set to true then the way i am suppose to return rights for a single user is to check every group he is a member of and sum up all the rights. In case management is set to false, that means that the rights member of the UserInfo struct has been filled with values, and working with group is redundant.

My idea was to turn the UserInfo struct into a class and set the rights member to private and expose instead a getRights() method which would decide how to return the rights. My question is how to do that? In this case I need somehow to pass the information about the state of the management variable to the UserInfo class and also a reference to the groups map? What is the most "objective" way to do this?