I know there are methods to prevent a class from being created on the heap, by preventing the user from using the new and delete operator. I am try
new
delete
Whenever a local variable goes out of scope, it is destroyed. And on destruction, destructor of object is called. Here, scope is of main function. When program exits, myclass object's destructor will be called