Aaron J. Seigo wrote:
> class A
> {
> public:
>       A() { foo = new std::string; }
>       ~A {delete foo; }
> 
> protected:
>       std::string* foo;
>       std::string bar;
> }
> 
> A myA();
> A* otherA = new A();
> ===========
> 
> myA is allocated on the stack, as is myA.bar. myA.foo is on the heap, however, 
> and the data that is contained in myA.bar is also most likely on the heap. 
> otherA is in the heap, otherA.foo is on the heap, otherA.bar is on the stack 
> (though it's data is probably in the heap).

I'm pretty sure that otherA.bar is also on the heap.

Dave

Reply via email to