dos_compilers/Borland Turbo C++ v1/EXAMPLES/VPOINT.H
2024-07-02 07:34:51 -07:00

33 lines
984 B
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* vpoint.h--Example from Chapter 5 of User's Guide */
// version of point.h with virtual functions for use with VCIRCLE
// vpoint.h contains two classes:
// class Location describes screen locations in X and Y coordinates
// class Point describes whether a point is hidden or visible
enum Boolean {false, true};
class Location {
protected: // allows derived class to access private data
int X;
int Y;
public: // these functions can be accessed from outside
Location(int InitX, int InitY);
int GetX();
int GetY();
};
class Point : public Location { // derived from class Location
// public derivation means that X and Y are protected within Point
protected:
Boolean Visible; // classes derived from Point will need access
public:
Point(int InitX, int InitY); // constructor
virtual void Show();
virtual void Hide();
Boolean IsVisible();
void MoveTo(int NewX, int NewY);
};