< previous page page_106 next page >

Page 106
LISTING 7.3 continued
d5ef64f4d3250b96ba5c07ca5bbc2f56.gif
34:        void SetLowerLeft(Point Location)  {itsLowerLeft = Location;}
35:        void SetUpperRight(Point Location)  {itsUpperRight = Location;}
36:        void SetLowerRight(Point Location)  {itsLowerRight = Location;}
37:
38:        void SetTop(int top) { itsTop = top; }
39:        void SetLeft (int left) { itsLeft = left; }
40:        void SetBottom (int bottom) { itsBottom = bottom; }
41:        void SetRight (int right) { itsRight = right; }
42:
43:        int GetArea() const;
44:
45:     private:
46:        Point  itsUpperLeft;
47:        Point  itsUpperRight;
48:        Point  itsLowerLeft;
49:        Point  itsLowerRight;
50:        int    itsTop;
51:        int    itsLeft;
52:        int    itsBottom;
53:        int    itsRight;
54:  };
55:  // end Rect.hpp

LISTING 7.4.RECT.CPP.

d5ef64f4d3250b96ba5c07ca5bbc2f56.gif
1:   // Begin rect.cpp
2:   #include rect.hpp
3:   Rectangle::Rectangle(int top, int left, int bottom, int right)
4:   {
5:         itsTop = top;
6:         itsLeft = left;
7:         itsBottom = bottom;
8:         itsRight = right;
9:
10:        itsUpperLeft.SetX(left);
11:        itsUpperLeft.SetY(top);
12:
13:        itsUpperRight.SetX(right);
14:        itsUpperRight.SetY(top);
15:
16:        itsLowerLeft.SetX(left);
17:        itsLowerLeft.SetY(bottom);
18:
19:        itsLowerRight.SetX(right);
20:        itsLowerRight.SetY(bottom);
21:  }
22:
d5ef64f4d3250b96ba5c07ca5bbc2f56.gif
continues

 
< previous page page_106 next page >

If you like this book, buy it!