Q67
In the following C++ code how many times the string "A's constructor called" will be printed? #include #include using namespace std; class A int a; public: A() cout<<"A's constructor called"; ; class B static A a; public: B() cout<<"B's constructor called"; static A get() return a; ; A B::a; int main(int argc, char const *argv[]) B b; A a1 = b.get(); A a2 = b.get(); A a3 = b.get();
A.
3
B.
4
C.
2
D.
1
AnswerAnswer: Option D
Solution
Answer: Option D
No explanation is given for this question Let's Discuss on Board