I\'m coming from a Java background and have started working with objects in C++. But one thing that occurred to me is that people often use pointers to objects rather than t
Object *myObject = new Object;
Doing this will create a reference to an Object (on the heap) which has to be deleted explicitly to avoid memory leak.
Object myObject;
Doing this will create an object(myObject) of the automatic type (on the stack) that will be automatically deleted when the object(myObject) goes out of scope.