What is the difference between a constructor and a destructor in C++?
Answer / 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 |
when can we use copy constructor?
Do class method definitions?
Write about a nested class and mention its use?
What are the effects after calling the delete this operator ?
How many types of scopes are there in c++?
What are c++ manipulators?
Can I learn c++ as my first language?
Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].
What is the benefit of c++?
Which bit wise operator is suitable for putting on a particular bit in a number?
What is a volatile variable in c++?
How do pointers work?