Advertisement
Need4Sleep

PointType.h (DailyC++) 7/22/12

Jul 23rd, 2012
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. /// http://www.cplusplus.com/forum/beginner/75558/
  2. #ifndef POINTTYPE_H
  3. #define POINTTYPE_H
  4. #include <iostream>
  5.  
  6. class PointType
  7. {
  8.     private:
  9.         int x;
  10.         int y;
  11.     public:
  12.         PointType(int xc, int yc):x(xc), y(yc) {}
  13.         virtual ~PointType(){}
  14.         void setx(int cord){x = cord;}
  15.         void sety(int cord){y = cord;}
  16.         int getx(){return x;}
  17.         int gety(){return y;}
  18.         friend std::ostream & operator<<(std::ostream & os, PointType & cords);
  19.  
  20. };
  21.  
  22. class Circle: public PointType
  23. {
  24.     private:
  25.         double r;
  26.     public:
  27.         Circle(int x, int y, double rr): PointType(x,y), r(rr) {}
  28.         void setr(double valf){r = valf;}
  29.         double Area();
  30.         double Circumference();
  31.         friend std::ostream & operator<<(std::ostream & os, Circle & crcl);
  32. };
  33.  
  34. #endif // POINTTYPE_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement