#include <iostream>
#include <vector>

// *****************************************************************************

class Figure {
  public:
    virtual double Area() = 0;
    void PrintName() {
      std::cout << "Фигура = " << Name() << " ";
    }
  private:
    virtual std::string Name() = 0;
};

// *****************************************************************************

class Rectangle: public Figure {
  public:
    explicit Rectangle(double h, double w): H(h), W(w) {}
    double Area() override {
      return H*W;    	
    }
  private:
    double H,W;
    std::string Name() override {
      return "Прямоугольник";
    }
};

// *****************************************************************************

class Square: public Rectangle {
  public:
    explicit Square(double l): Rectangle (l,l) {}
  private:
    std::string Name() override {
      return "Квадрат";
    }
};

// *****************************************************************************

class Ellipse: public Rectangle {
  public:
    explicit Ellipse(double a, double b): Rectangle (a,b) {}
    double Area() override {
      return Rectangle::Area()*3.1415;    	
    }
  private:
    std::string Name() override {
      return "Эллипс";
    }
};

// *****************************************************************************

int main() {
  std::vector<Figure*> V;
  V.push_back(new Rectangle(2,3));
  V.push_back(new Square(4));
  V.push_back(new Ellipse(2,3));
  for(const auto &i:V) {
    i->PrintName();
    std::cout << ", площадь: " << i->Area() << std::endl;
    delete i;
  }
  return 0;
}