Examveda

What is the difference between a constructor and a destructor in C++?

A. Constructor is called when an object is destroyed, while destructor is called when an object is created

B. Constructor is used to initialize objects, while destructor is used to free resources

C. Constructor is called when an object is created, while destructor is called when an object is destroyed

D. Constructor is used to free resources, while destructor is used to initialize objects

Answer: Option C


Join The Discussion

Related Questions on Classes and Objects in C plus plus