No, you can't do that.
A call to
delete t
where t is of the type T* do two things:
1)Call the destructor of t (T::~T if non virtual) if it exist
2)Release the memory occupied by t
If you remove line 9 of above code and make your destructor as you said, a2 destructor will never be called because when a2 go out of scope this is the destructor of
A* which is called (and it doesn't exist like all the built-in type, A* is a pointer).
And not sure but i guess a1 destructor will be called recursively.
Sometimes it is legal to do delete this but this is for very special usages on an internal class which should not be used outside.
You can modify the delete behaviour if you want but you have also to modify new behaviour( i let you ask google, tons of tutos exist) but this is advanced usage.
If what you want is just automatic memory management, check std::shared_ptr and his friends (boost or c++11):
(
http://en.wikipedia.org/wiki/Smart_pointer )