A function that is called automatically each time an object is destroyed is a A. constructor B. destructor C. destroyer D. terminator

constructor
destructor
destroyer
terminator

The correct answer is B. destructor.

A destructor is a special function that is called automatically when an object is destroyed. It is used to clean up any resources that the object may have allocated, such as memory or files.

A constructor is a special function that is called automatically when an object is created. It is used

to initialize the object’s data members.

A destroyer is not a valid option.

A terminator is not a valid option.

Exit mobile version