Geometry.h
#include "iostream" using namespace std;
class Point
{
struct Coordinate;
public:
Point(float a, float b) {coord.x = a; coord.y = b;}
Coordinate GetCoord() const {return coord;}
private:
struct Coordinate{float x; float y;}coord;
};
注:
若要将GetCoord()的定义写在类外,需要这样写:
Point::Coordinate Point::GetCoord() const {return coord;}
Geometry.cpp