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 there is no output.
B) 77
C) Hello!
D) the program will not compile
Correct Answer:
Verified
Q37: Which of the following is a directive
Q38: Assuming that Rectangle is a class name,
Q39: When you dereference an object pointer, use
Q40: The constructor function's return type is
A) int
B)
Q41: For the following code, which statement is
Q43: How many default constructors can a class
Q44: The constructor function always has the same
Q45: If a local variable and a global
Q46: When a member function is defined outside
Q47: The following code shows an example of
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