Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Rounded Rectangle.h */
- #pragma once
- #include "rectangle.h"
- //#include "twoD.h"
- class roundedRectangle:public rectangle //, public twoD
- {
- public:
- roundedRectangle(void);
- ~roundedRectangle(void);
- virtual double GetArea() const ;
- void SetRadius(double Radius);
- protected:
- double Radius;
- };
- /* Rounded Rectangle.cpp */
- #include "roundedRectangle.h"
- roundedRectangle::roundedRectangle(void)
- {
- Colour = "bugger green";
- }
- roundedRectangle::~roundedRectangle(void)
- {
- }
- double roundedRectangle::GetArea() const {
- // A = ab + 2r(a+b) + phi*r^2
- return ((Width*Height) + (2*Radius*Width + 2*Radius*Height) + (3.14*Radius*Radius) );
- }
- void roundedRectangle::SetRadius(double Radius){
- this->Radius = Radius;
- }
Advertisement
Add Comment
Please, Sign In to add comment