adplus-dvertising
frame-decoration

Question

In which case is it mandatory to provide a destructor in a class?

a.

Almost in every class

b.

Class for which two or more than two objects will be created

c.

Class for which copy constructor is defined

d.

Class whose objects will be created dynamically

Answer: (d).Class whose objects will be created dynamically

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. In which case is it mandatory to provide a destructor in a class?

Similar Questions

Discover Related MCQs

Q. The members of a class, by default, are

Q. Given a class named Book, which of the following is not a valid constructor?

Q. Which of the statements is true in a protected derivation of a derived class from a base class?

Q. Which of the following statements is NOT valid about operator overloading?

Q. Exception handling is targeted at

Q. A pointer to the base class can hold address of

Q. Function templates can accept

Q. How many constructors can a class have?

Q. The new operator

Q. Consider the following statements:
int x = 22,y=15;
x = (x>y) ? (x+y) : (x-y);
What will be the value of x after executing these statements?

Q. An exception is caused by

Q. A template class

Q. Which of the following is the valid class declaration header for the derived class d with base classes b1 and b2?

Q. A library function exit() causes an exit from

Q. RunTime polymorphism is achieved by ___________

Q. An array element is accessed using

Q. If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain a virtual member function abc(), then the statement p->abc(); will cause the version of abc() in the __________class to be executed.

Q. A pure virtual function is a virtual function that

Q. A static function

Q. We can output text to an object of class ostream using the insertion operator<< because