From 92e8d2a1aefce843e9635632cc13b9c512fea734 Mon Sep 17 00:00:00 2001 From: Angeld55 Date: Wed, 20 May 2020 03:04:17 +0300 Subject: fixed poly --- Polymorphism/Shapes/Circle.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Polymorphism/Shapes/Circle.cpp (limited to 'Polymorphism/Shapes/Circle.cpp') diff --git a/Polymorphism/Shapes/Circle.cpp b/Polymorphism/Shapes/Circle.cpp new file mode 100644 index 0000000..e625123 --- /dev/null +++ b/Polymorphism/Shapes/Circle.cpp @@ -0,0 +1,19 @@ +#include "Circle.h" + +Circle::Circle(int x, int y, int r) : Shape(1), radius(r) +{ + setPoint(x, y, 0); +} +double Circle::getArea() +{ + return PI * radius * radius; +} +double Circle::getPer() +{ + return 2 * PI * radius; +} +Shape* Circle::clone() +{ + Circle* newCircle = new Circle(*this); + return newCircle; +} \ No newline at end of file -- cgit v1.3.1-23-gd82d