C++
What are the differences between destructor and delete operator in C++?
You have to differentiate between objects created dynamically on the heap
with the 'new' operator, and objects created on the stack in a scope.
Using the delete operator instructs the program to call the destructor of
the class and then free the memory for the object. Objects that simply go
out of scope implicitely have the same process performed on them.
Reply:destructor is a method in C++ which is executed when the object is no longer used.
delete is an operator which is used to free the memory occupied by a variable.
In destructors we use delete to free up the memory of the variable.
kudzu
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment