Hello,
I'm lost on a question, probably simple: how can you destroy the occurrence of a class when it is no longer needed.
In the attached example, a class does a semblance of "ping" every second using a sleep. This occurrence is initialized in a sub of Main.
The event in the class starts a new sleep. So it seems to me that the occurrence can no longer be destroyed.
Of course, the question being when using external libs (mqtt for example or okhttp). That one is for simplicity demonstration only.
Thank you very much
I'm lost on a question, probably simple: how can you destroy the occurrence of a class when it is no longer needed.
In the attached example, a class does a semblance of "ping" every second using a sleep. This occurrence is initialized in a sub of Main.
The event in the class starts a new sleep. So it seems to me that the occurrence can no longer be destroyed.
Of course, the question being when using external libs (mqtt for example or okhttp). That one is for simplicity demonstration only.
Thank you very much