48 lines
1004 B
C++
48 lines
1004 B
C++
//
|
|
// Created by Marcus Vinicius de Carvalho
|
|
//
|
|
|
|
#ifndef MAIN_H
|
|
#define MAIN_H
|
|
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
enum KindOfPolygon {POLY_PLAIN, POLY_RECT, POLY_TRIANG};
|
|
|
|
inline string StringKindofPolygon[] = {"POLY_PLAIN", "POLY_RECT", "POLY_TRIANG"};
|
|
|
|
class Polygon {
|
|
protected:
|
|
string name;
|
|
float width;
|
|
float height;
|
|
KindOfPolygon polytype;
|
|
|
|
public:
|
|
virtual ~Polygon() = default;
|
|
|
|
Polygon(string name, float width, float height);
|
|
[[nodiscard]] KindOfPolygon getPolytype() const;
|
|
void setPolytype(KindOfPolygon polytype);
|
|
string getName();
|
|
virtual float calculateArea();
|
|
void printWidthHeight() const;
|
|
};
|
|
|
|
class Rectangle final : public Polygon {
|
|
public:
|
|
Rectangle(string name, float width, float height);
|
|
float calculateArea() override;
|
|
};
|
|
|
|
class Triangle final : public Polygon {
|
|
public:
|
|
Triangle(string name, float width, float height);
|
|
float calculateArea() override;
|
|
};
|
|
|
|
int main(int argc, const char * argv[]);
|
|
|
|
#endif //MAIN_H
|