Questions tagged as 'destrutor'

2
answers

What does '~' mean in front of the constructor of a C #

Working on a project here in the company, I came across some commands that are now being used the most ( yield , ?? , anonymous type ) but until I understood, but one that caught my attention because I did not know the what is....
asked by 12.03.2014 / 20:56
2
answers

What is a destructor for?

In some languages, classes have methods destructors . In the ones I've seen, it's declared as a constructor with the ~ sign on the front. Something like: public class Foo { public ~Foo() { //Fazer algo } } What are...
asked by 20.07.2015 / 13:28
1
answer

When the destructor of an object is called in C ++?

Let's suppose I have a function: std::string empty_string() { std::string x{ "" }; return x; } As much as it seems normal, it gets kind of confusing when we think: When the destructor of object x is called? Please no...
asked by 11.08.2018 / 04:15
2
answers

How does the destructor ("__destruct" method) work in PHP?

A big difference from PHP for Java, which is my native language, is that in Java there is no way to destroy obsolete objects, since JVM already does this for us automatically, with garbage collector . In PHP, there is no garbage collect...
asked by 19.11.2017 / 15:39
2
answers

Doubt about function in C ++ that works as a destructor? [closed]

I understood all the code below but in certain part the person quotes something as a destructor? What is it? What's the use? It would be this part here: ~Vetor() { delete [] vet_pos; delete [] vet; } Why is this ~ next to...
asked by 25.10.2018 / 21:24
1
answer

When I'm installing a class I need to perform a 'delete' after using the object even though the class has a destructor?

If I instantiate a class and render an object from it, I have to deallocate the memory of that object at the end of its use, right? But if the class that gave rise to my object has a destructor, will it be necessary to perform a delete on the ob...
asked by 10.09.2017 / 19:35
2
answers

What does '~' mean in front of the constructor of a C #

Working on a project here in the company, I came across some commands that are now being used the most ( yield , ?? , anonymous type ) but until I understood, but one that caught my attention because I did not know the what is....
asked by 12.03.2014 / 20:56