Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. class A;
  4. class B;
  5.  
  6. class A
  7. {
  8. private:
  9. int value_;
  10. public:
  11. A():
  12. value_(24)
  13. {
  14. }
  15. void showValue(void);
  16. };
  17.  
  18. class B
  19. {
  20. private:
  21. void (A::*pFunction)(void);
  22. public:
  23. void getFunction(void (A::*pointerToFunction)(void))
  24. {
  25. pFunction = pointerToFunction;
  26. }
  27. void useFunction(void)
  28. {
  29. pFunction;
  30. }
  31. };
  32.  
  33. int main(void)
  34. {
  35. A a;
  36. B b;
  37.  
  38. b.getFunction(a.showValue);
  39. b.useFunction();
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement