#include <iostream>
using namespace std;
class Shape {
public:
virtual void draw() const {
cout << "Draw generic shape" << endl;
}
void info() const {
cout << "This is a shape" << endl;
}
virtual ~Shape() {}
};
class Circle : public Shape {
public:
void draw() const override {
cout << "Draw a circle" << endl;
}
void info() const {
cout << "This is a circle" << endl;
}
};
class Rectangle : public Shape {
public:
void draw() const override {
cout << "Draw a rectangle" << endl;
}
void info() const {
cout << "This is a rectangle" << endl;
}
};
int main() {
Shape* shapes[2];
shapes[0] = new Circle();
shapes[1] = new Rectangle();
for (int i = 0; i < 2; ++i) {
shapes[i]->draw();
shapes[i]->info();
cout << "-------------------" << endl;
}
for (int i = 0; i < 2; ++i) {
delete shapes[i];
}
return 0;
}