0

How can we say that the object is destroyed or how the destructor be called?

27th Jul 2016, 10:13 AM
Dakilang Hokage
Dakilang Hokage - avatar
3 odpowiedzi
+ 1
you can destroy it by setting it variable=null; that way the garbage collector will dispose it. but you don't need to do it that much because the garbage collector is smart enough to know if you're not going to use the object anymore. except if the object last use is in a loop. the garbage collector will only notice if you don't use it and destroy it after the loop ends unless you set it to null. oh, and you can't have any other reference to that object. for example. two objects pointing to the same class. if you set one to null. the garbage collector won't do anything unless you set the other too.
28th Jul 2016, 7:12 AM
Julio González
Julio González - avatar
0
Because this is a console application all code will be ran through and then the application ends and this includes the destructors
27th Jul 2016, 11:11 AM
Connar
Connar - avatar
0
juste make it do something to be sure it's called. for example write something in a file. or check in the memory. easy to do if you are using vs2015
27th Jul 2016, 4:11 PM
Yoann Melchior
Yoann Melchior - avatar