Create a private destructor in the class. When you make a private destructor, the compiler would generate a compiler error for non-dynamically allocated objects because the compiler needs to remove them from the stack segment once they are not in use.
Answer:
Create a private destructor in the class. When you make a private destructor, the compiler would generate a compiler error for non-dynamically allocated objects because the compiler needs to remove them from the stack segment once they are not in use.
need an explanation for this answer? contact us directly to get an explanation for this answer