class A
{
public:
A();
~A();
int X;
};
A::A()
{
X = 5;
int Y = 4;
}
//..... in another file
A * objectOnHeap = new A();
In this case, since "objectOnHeap" is on the heap, is X also on the heap even though it wasn't specifically new'd up? And in this case Y is allocated on the stack (and of course goes out of scope), correct?
I am wondering if I have gotten my wires crossed when trying to envision how objects are stored in memory.