关于类先使用后定义
#include <iostream>using namespace std;
class test;
void main(){
test my;
my.show();
}
class test{
public:
int x;
test(int a=0){
x=a;
}
void show(){
cout<<x<<endl;
}
};
编译出错,error C2079: 'my' uses undefined class 'test'
求解释,感谢!