Is the address of the first data member of an instance the same as the address of the instance?

后端 未结 0 1942
傲寒
傲寒 2020-11-22 09:51
class Foo {
    public:
        int a;
        int b;
};

Foo x;
bool sameAddress =  (void*)&x  ==  (void*)&(x.a);

I have not yet come acros

相关标签:
回答
  • 消灭零回复
提交回复
热议问题