Question

Consider the following C++ code: #include class Base { public:     virtual void show() = 0; }; class Derived : public Base { public:     void show() override {         std::cout << "Derived::show()" << std::endl;     } }; int main() {     // Base b; // Line A     Derived d;    
d.show();     return 0; } What would be the output if `// Base b; // Line A` were uncommented and the code compiled?

A `Derived::show()`
B `Base::show()`
C A compile-time error indicating that `Base` is an abstract class.
D A runtime error.
E No output, but the program would terminate successfully.
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)