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
declare an array of structure where the members of the structure are integer variable float variable integer array char variable access all elements of the structure using dot operator and this pointer operator
What is difference between array and vector in c++?
Where the memory to the static variables is allocated?
What do you mean by function and operator overloading in c++?
What is the size of a vector?
Is c++ a difficult language?
What is the equivalent of Pascal's Real a) unsigned int b) float c) char
what is Member Functions in Classes?
Define the process of error-handling in case of constructor failure?
What is the use of namespace std in C++?
Explain friend class?
Define a constructor?
Program to check whether a word is a sub-string or not of a string typed
Is it possible for a member function to use delete this?
Do you know what are static and dynamic type checking?