Q206
What will be the output of the following C++ code? #include #include using namespace std; class A static int a; public: void show() a++; cout<<"a: "<<a<<endl; ; int A::a = 5; int main(int argc, char const *argv[]) A a; return 0;
A.
Error as a private member a is referenced outside the class
B.
Segmentation fault
C.
No output
AnswerD.
Program compiles successfully but gives run-time error
Answer: Option C
Solution
Answer: Option C
No explanation is given for this question Let's Discuss on Board