J
Jorn Attermann
I have a simple problem which I don't know how to handle. I have two
classes, X and Y, and in each I have a constructor which takes a reference
to the other as an argument as sketched below.
class X {
private:
int a;
public:
X();
X(Y&);
};
class Y {
private:
int b;
public:
Y();
Y(X&);
};
Naturally, the compiler complains because Y is undeclared when it parses the
definition of class X.
Any help is appreciated.
classes, X and Y, and in each I have a constructor which takes a reference
to the other as an argument as sketched below.
class X {
private:
int a;
public:
X();
X(Y&);
};
class Y {
private:
int b;
public:
Y();
Y(X&);
};
Naturally, the compiler complains because Y is undeclared when it parses the
definition of class X.
Any help is appreciated.