Vidyalelo
C++ Programming · Q53

Inheritance in C++

Programming · C++ Programming · question 53

Q53

What will be the output of the following C++ code? #include #include using namespace std; class A float d; public: A() cout<<"Constructor of class A "; ; class B: public A int a = 15; public: B() cout<<"Constructor of class B "; ; int main(int argc, char const *argv[]) B b; return 0;

A.
Constructor of class A
Constructor of class B
Answer
B.
Constructor of class A
C.
Constructor of class B
D.
Constructor of class B
Constructor of class A

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board