Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何访问 id 使用ptr?
ptr
class A { int id; public: int *ptr; }; void main() { int A::* ptr = &A :: id; getch(); }
尝试这个
class A { int id; public: int *ptr= &id; };
您可以使用变量指针来访问 id。