-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshape.h
42 lines (32 loc) · 877 Bytes
/
shape.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
#pragma once
#include <string>
#include <iostream>
enum class shape_type
{
n_Rectangle,
n_Square,
n_Circle,
n_Triangle
};
class shape
{
public:
/* copy constructor: */
/* shape(cosnt shape&); */
// undefined behavior UB
// virtual destructor
virtual ~shape() = default;
// abstruct
virtual float area() const = 0; // pure virtual method
virtual float perimeter() const = 0;
virtual float circumference() const = 0;
virtual std::ostream& shape_info(std::ostream&) const = 0;
virtual std::string shape_details() const = 0;
};
std::ostream& operator<<(std::ostream& os, const shape& sp);
/*
std::ostream& operator<<(std::ostream& os, const rectangle& rect);
std::ostream& operator<<(std::ostream& os, const square& sq);
std::ostream& operator<<(std::ostream& os, const circle& cir);
std::ostream& operator<<(std::ostream& os, const triangle& tri);
*/