Skip to main content
edited body
Source Link
b.roth
  • 9.6k
  • 8
  • 40
  • 50
class A { public: int i; }; A a**a = new A(); 

How to get the address of a->i? I tried &a->i and also &(a->i) but those generate compile time errors:

"left of '.i' must have class/struct/union type"

class A { public: int i; }; A a* = new A(); 

How to get the address of a->i? I tried &a->i and also &(a->i) but those generate compile time errors:

"left of '.i' must have class/struct/union type"

class A { public: int i; }; A *a = new A(); 

How to get the address of a->i? I tried &a->i and also &(a->i) but those generate compile time errors:

"left of '.i' must have class/struct/union type"

edited tags
Link
Stefano Borini
  • 144.9k
  • 103
  • 310
  • 448
added 2 characters in body
Source Link
b.roth
  • 9.6k
  • 8
  • 40
  • 50
class A { public: int i; }; A a* = new A(); 

How to get the address of a->i? I tried &a->i and also &(a->i) but those generate compile time errors:

"left of '.i' must have class/struct/union type"

class A { public int i; } A a* = new A(); 

How to get the address of a->i? I tried &a->i and also &(a->i) but those generate compile time errors:

"left of '.i' must have class/struct/union type"

class A { public: int i; }; A a* = new A(); 

How to get the address of a->i? I tried &a->i and also &(a->i) but those generate compile time errors:

"left of '.i' must have class/struct/union type"

Source Link
b.roth
  • 9.6k
  • 8
  • 40
  • 50
Loading