fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct CData {
  5. int m_x;
  6. int m_y;
  7. };
  8.  
  9. int main() {
  10. CData obj = {10, 20};
  11. int CData::*pData = &CData::m_x;
  12.  
  13. cout << obj.*pData << endl;
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
10