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

34 lines
690 B
C
Raw Permalink Normal View History

2024-10-30 07:36:34 +08:00
//
// 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