This question is different from those duplicated ones.
I have 2 classes A and B. B has a member function B::boy that uses its variable b.
A has a member function A::evaluate and in this member function, I need to use B::boy.
The problem now is that :
1) B::boy cannot be static because it needs to use a non-static variable b.
2) I cannot instantiate a object of B in A. Because I have one object of B elsewhere and that stores the variable b that is also useful in A.
Is it not possible to be done in C++?
Aucun commentaire:
Enregistrer un commentaire