#include "point.h"
#include <iostream>
using std::cout;
using std::endl;
void print(const Point& p)
{
cout << "x: " << p.getX() << endl;
cout << "y: " << p.getY() << endl;
cout << "z: " << p.getZ() << endl;
}
int main()
{
Point p(1.0, 2.0, 3.0);
print(p);
return 0;
}
#ifndef POINT_H
#define POINT_H
class Point
{
public:
Point();
Point(const double x, const double y, const double z);
double getX() const
{
return x;
}
double getY() const
{
return y;
}
double getZ() const
{
return z;
}
private:
double x;
double y;
double z;
};
#endif
#include "point.h"
Point::Point() :
x(0.0), y(0.0), z(0.0)
{
}
Point::Point(const double x, const double y, const double z) :
x(x), y(y), z(z)
{
}