#include <iostream>
#include <conio.h>
using namespace std;
class Point
{
public:
int GetPointX() const { return xcod; }
int GetPointY() const { return ycod; }
void SetPoint(int newX, int newY)
{
xcod = newX;
ycod = newY;
}
private:
int xcod;
int ycod;
};
int main()
{
Point point;
cout << "So we created an object 'point'" << endl;
cout << "Let's set coordinates 3 and 5 to X and Y respectively" << endl;
point.SetPoint(3,5);
cout << "We can check it's coordinates: " << endl;
cout << "X = " << point.GetPointX() << endl;
cout << "Y = " << point.GetPointY() << endl;
_getch();
return 0;
}
Comments