I
Ivan Liu
Hi,
I'd like to know if I declare and initialise a reference as the
following:
MyClass & rA = *( new MyClass( my_arguements) );
at the end of the routine will the memory containing the object, which
rA refers to, be freed?
Alternatively I would first declare a pointer and then at the end
delete
the pointer, like:
MyClass * pA = new MyClass( my_arguements);
MyClass & rA = *pA;
delete pA;
But I wonder if the first case the memory is freed. thanks
I'd like to know if I declare and initialise a reference as the
following:
MyClass & rA = *( new MyClass( my_arguements) );
at the end of the routine will the memory containing the object, which
rA refers to, be freed?
Alternatively I would first declare a pointer and then at the end
delete
the pointer, like:
MyClass * pA = new MyClass( my_arguements);
MyClass & rA = *pA;
delete pA;
But I wonder if the first case the memory is freed. thanks