LogiQuest
Back to Inheritance
9

What will be the output of the program?

#include <iostream>
using namespace std;
class A { public: A(int v) { cout << v; } };
class B : public A { public: B() : A(7) { cout << 8; } };
int main() {
    B b;
    cout << endl;
    return 0;
}
Medium

Discussion (0)

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

Log in to join the discussion.