What is the difference between constructor & destructor?

S.no Constructor Destructor
1. It allocates the memory to an object. It deallocates the memory of an object.
2. It accepts argument. It does not take an argument.
3. In a class, there can be multiple constructors. In a class, there can only be one destructor.

Suggest An Answer

No suggestions avaliable!

Latest post from Full stack developer interview questions

Ask Question