-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPolygon.h
46 lines (39 loc) · 834 Bytes
/
Polygon.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef POLYGON_H
#define POLYGON_H
#include "Line.h"
/*
Class used to create different types of polygons.
Keeps track of the edges but needs to be allocated
a number of them to account for many different types
of polygons
*/
class Polygon
{
public:
//Constructor that takes the number of edges for the polygon
//and creates a new dynamic array of edges equal to that
//number
Polygon(int numEdges)
{
edges = new Line[numEdges];
}
//Remove all dynamically-allocated memory
~Polygon()
{
delete[] edges;
}
//Need to fix both of these functions so
//the children can correctly Override them...
virtual double getArea()
{
return 0;
}
virtual double getPerimeter()
{
return 0;
}
/////////////////////////////////////////////
protected:
Line *edges;
};
#endif