In your example above, since the class instance is created on the stack, it is automatically deleted when the function ends, since it goes out of scope.
I.e - your object no longer consumes memory after the closing brace } of the function.
As for creating and deleting objects, you could do so like this:
testObj = new test;
some operations using testObj
Note, that when you create objects like this they will NOT be automatically deleted when they go out of scope. (The 4bytes(on a 32bit sys) used to point to the object will be returned to the stack, but the memory consumed by the class object itself, won't be)
If you were to change your code above to:
test *testObj1 = new test;