Your code wont compile as is. What you need to have is
void aFunction
{
A a; // create local auto object on the stack
A* ap = new A() // create object on the heap & have ap refer to it
// do something
delete ap; // manually delete object that ap refers to
} // here a & ap are destroyed automatically