Question OOP-ABS-0018
HardWhat is the output of this code?
#include <iostream>
using namespace std;
class Shape {
public:
virtual int area() = 0;
void describe() { cout << "Area: " << area(); }
virtual ~Shape() {}
};
class Rectangle : public Shape {
public:
int area() override { return 3 * 4; }
};
int main() {
Rectangle r;
r.describe();
return 0;
}
- A.
Area: 12
- B.
Area: 7
- C.
Sign up free to see the answer and a step-by-step explanation.