Most voted "destructor" questions
8 questions
Sort by count of
-
32
votes2
answers1436
viewsWhat it means '~' in front of the constructor of a C#class
Working on a project here at the company, I came across some commands that are now being used more (yield, ??, anonymous type) but until I understood, but one who called my attention by not knowing…
-
8
votes2
answers742
viewsWhat’s a destroyer for?
In some languages, classes have methods destructors. In the ones I’ve seen, he’s declared a builder with the sign ~ in front. Something like: public class Foo { public ~Foo() { //Fazer algo } } What…
-
4
votes1
answer129
viewsWhen is the destroyer of an object called in C++?
Let’s assume I have a function: std::string empty_string() { std::string x{ "" }; return x; } As normal as it sounds, it gets a little fuzzy when we think: When the destroyer of the object x is…
-
4
votes1
answer38
viewsUse of delete in an abstract class pointer
Reading the book A tour of C++, in a section on memory leakage, when I came across 3 statements regarding the code below: The implementation of Smiley may fail to delete pointer to mouth. The…
-
3
votes2
answers337
viewsHow does the destructor ("__destruct" method) work in PHP?
A big difference from PHP to Java, which is my native language, is that in Java there is no way to destroy objects that are in disuse, because the JVM already does it for us automatically, with the…
-
1
votes1
answer61
viewsWhen I am instating a class I need to perform a 'delete' after using the object even if the class has a destructor?
If I instate a class and Gero an object from it obligatorily I have to displace the memory of that object at the end of its use, right? But if the class that originated my object has a destructor it…
-
1
votes2
answers297
viewsQuestion about a C++ function that functions as a destructor?
I understood all the code below but in a certain part the person cites something as destructor? What is it? What is it for? That would be the part here: ~Vetor() { delete [] vet_pos; delete [] vet;…
-
-1
votes1
answer42
viewsDestroy array in C++
Speak devs, I’m trying to destroy the Wheel array but I get an error message: error: expected Primary-Expression before ';' token How can I fix the error? Follow my files if you can take a look:…