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

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