Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. class A
  2. {
  3. public:
  4.     B component;
  5.     int counter;
  6. }
  7.  
  8. //First option
  9. class A;
  10. class B
  11. {
  12. public:
  13.     update(A& boss)
  14.     {
  15.         A.couter++;
  16.     }
  17. }
  18.  
  19. //Second option
  20. class A;
  21. class B
  22. {
  23. public:
  24.     A* refToBoss;
  25.     update()
  26.     {
  27.         refToBoss->counter++;
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement