home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 7.img / EXAMPLES.ZIP / POINT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-04  |  901 b   |  32 lines

  1. /* point.h--Example from Chapter 5 of Getting Started */
  2.  
  3. // point.h contains two classes:
  4. // class Location describes screen locations in X and Y coordinates
  5. // class Point describes whether a point is hidden or visible
  6.  
  7. enum Boolean {false, true};
  8.  
  9. class Location {
  10. protected:          // allows derived class to access private data
  11.    int X;
  12.    int Y;
  13.  
  14. public:             // these functions can be accessed from outside
  15.    Location(int InitX, int InitY);
  16.    int GetX();
  17.    int GetY();
  18. };
  19. class Point : public Location {      // derived from class Location
  20. // public derivation means that X and Y are protected within Point
  21.  
  22.    protected:
  23.    Boolean Visible;  // classes derived from Point will need access    
  24.  
  25. public:
  26.    Point(int InitX, int InitY);      // constructor
  27.    void Show();
  28.    void Hide();
  29.    Boolean IsVisible();
  30.    void MoveTo(int NewX, int NewY);
  31. };
  32.