01 #ifndef POINT2D_H
02 #define POINT2D_H
03 class Point2D
04 {
05 public:
06 Point2D();
07 Point2D(double x, double у);
08 void setX(double x);
09 void setY(double у);
10 double x() const;
11 double y() const;
12 private:
13 double xVal;
14 double yVal;
15 };
16 #endif
Реализация функций выполнялась бы в файле point2d.cpp:
01 #include "point2d.h"
02 Point2D::Point2D()
03 {
04 xVal = 0.0;
05 yVal = 0.0;
06 }
07 Point2D::Point2D(double x, double у)
08 {
09 xVal = x;
10 yVal = у;
11 }
12 void Point2D::setX(double x)
13 {