我很想知道初始化的成员变量在内存中的位置?即css、bss、数据段、堆...
如果我的问题很愚蠢,请不要诅咒我:)例如
class A
{
A();
int m_iVar;
}
A::A(int i)
{
m_iVar = i;
}
A::A()
{
m_iVar = 99;
}
main()
{
A o; // => After compilation, the object o, in which segment does it reside? and especially where does "m_iVar" reside
A o1(5); // => After compilation here object o1, in which segment does it reside?and especially where does "m_iVar" reside?
A *pA = new A; // After compilation, here the memory pointed by pA, I guess it goes to heap, but the variable "m_iVar" where does it reside
}