G
G
Grigory Dikiy2015-04-06 21:52:49
OOP
Grigory Dikiy, 2015-04-06 21:52:49

How to call destructor only when exiting main?

Hello, a situation of the following kind arose: I have a lot of function nesting, including those that create objects, I need the destructor not to work after it exits after the first {}, but at the very end. Is there a solution for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2015-04-06
@frilix

We must guess the language. In C++, you can create objects with new and then explicitly destroy them with delete, but some people think you need to work on your application's architecture. And it's better to use smart pointers - shared_ptr for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question