MCQs > IT & Programming > C++ > Answer the question that follows. class A { public: A() {} ~A() { cout << 'in destructor' << endl; } }; void main() { A a; a.~A(); } How many times will 'in destructor' be output when the above code is compiled and executed?

C++ MCQs

Consider the sample code given below and answer the question that
follows.
class A
{
public:
A() {}
~A()
{
cout << "in destructor" << endl;
}
};
void main()
{
A a;
a.~A();
}
How many times will "in destructor" be output when the above code is
compiled and executed?

Answer

Correct Answer: 2

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C++ Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

C++ Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it