Guest User

Untitled

a guest
Dec 11th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. // Forward declarations
  2. class A;
  3.  
  4. class B
  5. {
  6. public:
  7. B(A* aPtr) : m_pA(aPtr)
  8.  
  9. void Schedule();
  10. void Update();
  11.  
  12. private:
  13. A* m_pA;
  14. }
  15.  
  16. void B::Schedule()
  17. {
  18. Timer::ref().Schedule(1000, [this]() { Update(); });
  19. }
  20.  
  21. void B::Update()
  22. {
  23. m_pA->DoSomething();
  24. }
  25.  
  26. class A
  27. {
  28. public:
  29. void Create() { m_B = std::make_unique<B>(); }
  30. void DoSomething() {}
  31.  
  32. private:
  33. std::unique_ptr<B> m_B;
  34. }
Add Comment
Please, Sign In to add comment