-
Notifications
You must be signed in to change notification settings - Fork 0
/
Triangle.h
55 lines (32 loc) · 1.05 KB
/
Triangle.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
47
48
49
50
51
52
53
54
55
#ifndef TRIANGLE_H
#define TRIANGLE_H
#include "Shape.h"
using namespace std;
class Triangle : public Shape {
public:
Triangle() = delete;
Triangle(int triangleHeight, int triangleBase, const string &gn, const string &desc = "");
Triangle(const Triangle &) = default;
~Triangle() override;
const Triangle &operator=(const Triangle &rhs);
int getHeight() const;
void setHeight(int h);
int getBase() const;
string toString() const override;
virtual void scale(int n) = 0;
double geoArea() const override;
virtual double geoPerimeter() const = 0;
virtual int scrArea() const = 0;
virtual int scrPerimeter() const = 0;
int bBoxWidth() const override;
int bBoxHeight() const override;
/* Draws textual image of the shape on a drawing surface*/
virtual void draw(Canvas &canvas, int c, int r, char fg, char bg = ' ') const = 0;
protected:
void setBase(int b);
private:
int height;
int base;
};
ostream &operator<<(ostream &ostr, const Triangle &rhs);
#endif // !TRIANGLE_H