NTU-OOP-Tuts-2024-Cpp/T8Q2_2/Polygon.h

34 lines
690 B
C++

//
// Created by Marcus Vinícius de Carvalho
//
#ifndef POLYGON_H
#define POLYGON_H
#include <string>
using namespace std;
enum KindOfPolygon {POLY_PLAIN, POLY_RECT, POLY_TRIANGLE};
inline string StringKindofPolygon[] = {"POLY_PLAIN", "POLY_RECT", "POLY_TRIANGLE"};
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;
};
#endif //POLYGON_H