Simple2012

Untitled

Oct 20th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. /* Rounded Rectangle.h */
  2. #pragma once
  3. #include "rectangle.h"
  4. //#include "twoD.h"
  5. class roundedRectangle:public rectangle //, public twoD
  6. {
  7. public:
  8.     roundedRectangle(void);
  9.     ~roundedRectangle(void);
  10.  
  11.     virtual double GetArea() const ;
  12.     void SetRadius(double Radius);
  13. protected:
  14.     double Radius;
  15. };
  16.  
  17.  
  18. /* Rounded Rectangle.cpp */
  19. #include "roundedRectangle.h"
  20.  
  21. roundedRectangle::roundedRectangle(void)
  22. {
  23.     Colour = "bugger green";
  24. }
  25. roundedRectangle::~roundedRectangle(void)
  26. {
  27. }
  28. double roundedRectangle::GetArea() const {
  29.     // A = ab + 2r(a+b) + phi*r^2
  30.     return ((Width*Height) + (2*Radius*Width + 2*Radius*Height) + (3.14*Radius*Radius) );
  31. }
  32. void roundedRectangle::SetRadius(double Radius){
  33.     this->Radius = Radius;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment