Question OOP-INH-0046
MediumWhat is the output of this code?
#include <iostream>
using namespace std;
class Base {
public:
void show() { cout << "Base "; }
};
class Derived : public Base {
public:
void show() { cout << "Derived "; }
};
int main() {
Derived d;
Base *p = &d;
p->show();
d.show();
}
- A.
Derived Base
- B.
Base Derived
- C.
Sign up free to see the answer and a step-by-step explanation.