I have the following pattern for many module/service/class on my server code:
class Sercice1PerClient
{
void method1(int i)
{
printf("%s", StateOfTheClient);
}
void method2(int i)
{
printf("foo %s bar", StateOfTheClient);
}
char *StateOfTheClient;
}
class Service1
{
void method1(int i, int clientID)
{
v[clientID].method1(i);
}
void method2(int i, int clientID)
{
v[clientID].method2(i);
}
std::vector<Sercice1PerClient> v
}
The problem I face is every time I want to change method1
I have to do it 4 times (2 in the cpp and 2 in the header)
Is there any better way to keep the state of each client separate from each other without having to repeat all the functions in the "mother class"?
Does this pattern has a name and do you think it's reasonable?
Aucun commentaire:
Enregistrer un commentaire