Question

Consider the following C++ code: #include class Base { public:     Base() {         std::cout << "Base constructor" << std::endl;     } }; class Derived : public Base { public:     Derived() {         std::cout << "Derived constructor" << std::endl;     } }; int main() {     Derived d;     return 0; } What will be the output of this code?

A Derived constructor\nBase constructor
B Base constructor\nDerived constructor
C Base constructor
D Derived constructor
E No output.
Practice Next

Hey! Ask a query

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)