Website Summary Files Commits Branches @commit @diff @stats
path: root / Polymorphism / Shapes / Circle.cpp
diff options
context:
space:
mode:
1 files changed, 19 insertions, 0 deletions
-rw-r--r--Polymorphism/Shapes/Circle.cpp19
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