Question OOP-POLY-0009
MediumWhat is the output of this code?
#include <iostream>
using namespace std;
class Shape {
public:
void draw() { cout << "Shape"; }
};
class Circle : public Shape {
public:
void draw() { cout << "Circle"; }
};
int main() {
Shape* s = new Circle();
s->draw();
delete s;
return 0;
}
- A.
Error
- B.
Shape
- C.
Sign up free to see the answer and a step-by-step explanation.