[Solved] Garbage Collector and destructor [duplicate]


No, the destructor (~myClass) just does the stuff you want him to do when an object is no longer needed, like freeing resources (files, connections, …).
Its the opposite of the constructor (myClass), where you set up your object (getting connections, etc).
The GC removes all pointers to the myClass-object when it goes out of scope or the destructor was called (I think). So the location where your object was before in memory can be allocated again.

1

solved Garbage Collector and destructor [duplicate]