BHXSpecter

Ch15 Operator I/O Overloading

Nov 3rd, 2011
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #ifndef H_CLASSRECT3
  2. #define H_CLASSRECT3
  3.  
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. class rectangleType
  8. {
  9.     friend ostream& operator<<(ostream&, const rectangleType&);
  10.     friend istream& operator>>(istream&, rectangleType&);
  11.    
  12.     public:
  13.         void setDimension(double l, double w);
  14.         double getLength() const;
  15.         double getWidth() const;
  16.         double area() const;
  17.         double perimeter() const;
  18.         void print() const;
  19.         rectangleType operator+(const rectangleType&) const;
  20.         rectangleType operator*(const rectangleType&) const;
  21.         bool operator==(const rectangleType&) const;
  22.         bool operator!=(const rectangleType&) const;
  23.         rectangleType();
  24.         rectangleType(double l, double w);
  25.     private:
  26.         double length;
  27.         double width;
  28. };
  29.  
  30. #endif
  31.  
Advertisement
Add Comment
Please, Sign In to add comment