diff options
Add files via upload
1 files changed, 19 insertions, 0 deletions
| -rw-r--r-- | Polymorphism/Circle.cpp | 19 |
diff --git a/Polymorphism/Circle.cpp b/Polymorphism/Circle.cpp new file mode 100644 index 0000000..6ba083f --- /dev/null +++ b/Polymorphism/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 |
