What is the output of the following program? #include using namespace std; class TestClass { private: int val; void showVal() { cout << val << endl; } public: TestClass(int x) { val = x; } }; int main() { TestClass test(77); test.showVal(); return 0; }
A) The program runs, but with no output.
B) 77
C) 0
D) The program will not compile."

Q&A Education