Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Testpm
- {
- public:
- void m_func1()
- {
- cout << "func1\n";
- }
- int m_num;
- };
- void (Testpm :: *pmfn)() = &Testpm :: m_func1;
- int Testpm :: *pmd = &Testpm :: m_num;
- int main()
- {
- Testpm ATestpm;
- Testpm *pTestpm = new Testpm;
- (ATestpm.*pmfn)();
- (pTestpm ->* pmfn)();
- ATestpm.*pmd = 1;
- pTestpm ->* pmd = 2;
- cout << ATestpm.*pmd << endl
- << pTestpm ->* pmd << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement