クラスの配列を別のクラスに渡す構文について誰か助けてくれませんか。クラスの配列を別のクラスに渡す構文には、私は打ちのめされました。クラス行は点の配列で初期化しようとしましたが、プロトタイプが一致しません。
#include <iostream>
using namespace std;
class point {
public:
point() {}
point(int x, int y) : X(x), Y(y) {}
void setXY(int x, int y) { X = x; Y = y; }
int getX() { return X; }
int getY() { return Y; }
private:
int X, Y;
};
class line {
public:
line(point *points, int); // Problem line.
private:
point *coords;
int numpoints;
};
int main() {
point points[3];
points[0].setXY(3, 5);
points[1].setXY(7, 9);
points[2].setXY(1, 6);
line l(points, 3); // Problem line.
return 0;
}
エラー メッセージ: cygdrive/c/Tmp/cc4mAXRG.o:a.cpp:(.text+0xa7): 「line::line(point*, int)」への未定義の参照