Home / MCQ Bank / Computer
Computer Inheritance In C Plus Plus

What happens if the following C++ program is compiled? #include <iostream> #include <string> using namespace std; class A { int a; public: A(){ a = 0; } void show(){ a++; cout<<"a: "<<a<<endl; } }; class B: private A { public: void show(){ show(); } }; int main(int argc, char const *argv[]) { B b; b.show(); return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • Program will compile successfully

Related Computer Questions

Which of the following cipher requires only one key for decoding the ciphered text? Which of the following code constructs vector of length 11? Which traversal method is used to obtain the nodes of a BST in the reverse order of their sorted values? Which of the following is not a database application? The mode of search in which the search string is parsed into words and the search looks for rows is ______