Question

Consider the following C++ code: #include #include class Printer { public:     void print(int num) {         std::cout << "Printing int: " << num << std::endl;     }     void print(std::string text) {         std::cout << "Printing string: " << text << std::endl;     } }; int main() {     Printer p;     p.print(123);     p.print("Hello");     return 0; } What will be the output of this code?

A Printing int: 123 Printing string: Hello
B Printing string: Hello Printing int: 123
C Printing int: 123 Printing int: 0
D A compile-time error due to ambiguous call.
E A runtime error.
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)