SHARE
TWEET

cplus

Dprogrammed1 Apr 1st, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.     using namespace std;
  3.     class Testpm
  4.     {
  5.         public:
  6.         void m_func1()
  7.         {
  8.             cout << "func1\n";
  9.         }
  10.         int m_num;
  11.     };
  12.     void (Testpm :: *pmfn)() = &Testpm :: m_func1;
  13.     int Testpm :: *pmd = &Testpm :: m_num;
  14.     int main()
  15.     {
  16.         Testpm ATestpm;
  17.         Testpm *pTestpm = new Testpm;
  18.         (ATestpm.*pmfn)();
  19.         (pTestpm ->* pmfn)();
  20.         ATestpm.*pmd = 1;
  21.         pTestpm ->* pmd = 2;
  22.         cout << ATestpm.*pmd << endl
  23.         << pTestpm ->* pmd << endl;
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top