Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class A;
- class B;
- class A
- {
- private:
- int value_;
- public:
- A():
- value_(24)
- {
- }
- void showValue(void);
- };
- class B
- {
- private:
- void (A::*pFunction)(void);
- public:
- void getFunction(void (A::*pointerToFunction)(void))
- {
- pFunction = pointerToFunction;
- }
- void useFunction(void)
- {
- pFunction;
- }
- };
- int main(void)
- {
- A a;
- B b;
- b.getFunction(a.showValue);
- b.useFunction();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement