如何在宣布课程之前宣布课程?
我想我需要像类原型一样的东西。
Class First
{
public:
int Method1(Second* second); // Error: Undefined class Second
private:
int Attribute1;
}
Class Second
{
public:
int Method1(First* first);
private:
int Attribute2;
}
提前致谢。
答案 0 :(得分:0)
您需要的是forward declaration:
class Second;
class First
{
public:
int Method1(Second* second);
private:
int Attribute1;
};