What is the output of the following program?
#include <iostream>
using namespace std;
class TestClass
{
public:
TestClass(int x)
{ cout << x << endl; }
TestClass()
{ cout << "Hello!" << endl; }
};
int main()
{
TestClass test(77) ;
return 0;
}
A) The program runs, but with no output.
B) 77
C) Hello!
D) The program will not compile.
Correct Answer:
Verified
Q7: More than one destructor function may be
Q8: You must declare all data members of
Q9: Class objects can be defined prior to
Q13: The constructor function may not accept arguments.
Q23: This is automatically called when an object
Q25: What is the output of the
Q31: The process of object-oriented analysis can be
Q32: Whereas object-oriented programming centers around the object,
Q39: Object-oriented programming is centered around the object,
Q45: If a local variable and a global
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents