DearS I want to know what background work is done by compiler/OS when i dynamically create an object . my concern about what data structure it use to create the objects and allocate memory and when those data structures destroy can i explicitly destroy those data structures for example when i create a sub class object compiler create a virtual table if super class have a virtual function Thanks and Regards Rahul
You only need to concern yourself with the object itself. Every new X must be matched with a delete X. If the compiler adds extra code to allocate additional structures when you call new X, it will also add extra code to deallocate those structures when you call delete X. You cannot explicitly deallocate those extra structures yourself.