Question: what is the difference between constructor and destructor?
Answer: A constructor is called when the instance or object of the class is created. Destructor is called while the object of the class is freed or deleted. A constructor is used to allocate the memory to an instance or object. While Destructor is used to deallocate the memory of an object of a class.