Which among the following is true?

Đăng Khánh

New member
Which among the following is true?
A. A class may have virtual destructor but not virtual constructor
B. A class may have virtual constructor but not virtual destructor
C. A class may have virtual constructor and virtual constructor
D. A class may have either virtual destructor or virtual constructor
 
Answer: a
Explanation: Any class can contain virtual destructor. But is not possible to define a virtual constructor. The reason behind is that the destructors can be overridden but constructors should not be.
 

Tìm kiếm

Back
Top