LogiQuest
Back to Inheritance
10

What will be the output of the program?

#include <iostream>
using namespace std;
class A { public: void hi() { cout << "A"; } };
class B : public A { public: void hi() { cout << "B"; A::hi(); } };
int main() {
    B b;
    b.hi();
    cout << endl;
    return 0;
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.