-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshapes.h
More file actions
39 lines (35 loc) · 977 Bytes
/
shapes.h
File metadata and controls
39 lines (35 loc) · 977 Bytes
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
struct Point {
float x, y;
/*
Todo adaugati 2 constructori. Unul implicit care initializeaza punctul
cu (0, 0) si unul care primeste cele 2 valori pentru x si y
*/
};
class Shape {
protected:
virtual double perimeter() = 0;
virtual double area() = 0;
virtual vector<Point> getPoints() = 0;
};
class Triangle : public Shape {
vector<Point> points;
public:
Triangle(const Point& p1, const Point& p2, const Point& p3) {
// TODO populati vectorul de puncte
}
// TODO suprascrieti cele 3 metode din clasa shape
};
class Rectangle : public Shape {
public:
Rectangle(const Point& leftCorner, double width, double height) {
/*
Alegeti un mod de reprezentare al dreptunghiului care sa fie
eficient din punct de vedere al memoriei ocupate
*/
}
};
/*
TODO
Implementati clasa Square care sa reprezinte un patrat.
Folositi-va de legatura dintre patrat si dreptunghi
*/