What is the difference between a constructor and a destructor in C++?
Answer Posted / nashiinformaticssolutions
While a destructor is used to remove class objects, a constructor aids in initializing them. Both are invoked automatically: the constructor allocates memory instantly upon creating a new object, and the destructor deals with memory when destroying an existing one.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is pointer with example?
Which one is better- macro or function?
What are the effects after calling the delete this operator ?
What does new in c++ do?
What is std :: flush?
What do you mean by stack unwinding in c++?
Give 10 points of differences between C & C++.
what is scupper?
What are the basics of local (auto) objects?
What is the difference between #define debug 0 and #undef debug?
Where and why do I have to put the "template" and "typename" keywords?
What is the difference between object-oriented programming and procedural programming?
When one must use recursion function? Mention what happens when recursion functions are declared inline?
Will the following program execute?
What do you mean by inheritance in c++?