DotNetGnat
Programmer
Guys,
let say I have a class A and I use the following two lines of code...
A a("ddd");
A* pa = new A("dsfd");
This is my understanding...The first one creates an object of class A and the second one creates an object of class A and returns a pointer reference...is that right...
when both of these objects go out of scope, does the destructor get called in both cases...or since I have used the new keyword in the second case...do I need to explicitly use delete keyword to deallocate the memory...
please shed some light on this issue...
thanks
-DNG
let say I have a class A and I use the following two lines of code...
A a("ddd");
A* pa = new A("dsfd");
This is my understanding...The first one creates an object of class A and the second one creates an object of class A and returns a pointer reference...is that right...
when both of these objects go out of scope, does the destructor get called in both cases...or since I have used the new keyword in the second case...do I need to explicitly use delete keyword to deallocate the memory...
please shed some light on this issue...
thanks
-DNG