Skip to content

Commit

Permalink
figures.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWitness63 authored Dec 31, 2024
1 parent d79682d commit af161d4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions task2/figures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,51 @@ class Figure {

class Rect : public Figure
{
private:
double width;
double height;

public:
Rect(double a, double b);
FigureType Type() const override;
double Perimeter() const override;
double Area() const override;
};

class Triangle : public Figure
{
double a, b, c;

public:
Triangle(double side_a, double side_b, double side_c);
FigureType Type() const override;
double Perimeter() const override;
double Area() const override;
};

class Circle : public Figure
{
private:
double a;

public:
Circle(double radius);
FigureType Type() const override;
double Perimeter() const override;
double Area() const override;
};

std::unique_ptr<Figure> make_figure(FigureType type, double a, double b = 0, double c = 0);

class WrongTriangle : public std::invalid_argument
{
public:
using std::invalid_argument::invalid_argument;
};

class LessThanZeroParam : public std::invalid_argument
{
public:
using std::invalid_argument::invalid_argument;
};

0 comments on commit af161d4

Please sign in to comment.