如何拥有在当前类之后定义的类的变量

How to have a variable of a class which has been defined after current class?

本文关键字:之后 定义 变量 何拥有 拥有      更新时间:2023-10-16

这是我的c++ CLI代码:

public ref class SVeh{
public:
    bool Is( Pla^ For);
};

PlaSVeh之后定义。

public ref class Pla{
public:
    bool somemethod();
};

编译器将Pla类作为未知标识符,不进行编译。如何解决这个问题?

我不知道c++/CLI,但如果它类似于c++,你可以向前声明Pla:

ref class Pla;
public ref class SVeh{
  // rest of code