#include <iostream>
using namespace std;
template <class numtype>
class Compare
{
public:
numtype* x;
};
class test
{
public:
void fun(){
std::cout << "fun" << std::endl;
}
};
int main()
{
Compare<test> a;
a.x = new test();
a.x->fun(); // <-- this line
delete a.x;
return 0;
}
代码另外在图片中只是为了清楚地显示问题。我点fun()
进去main
。我收到一条错误消息,提示“找不到符号:有趣”。我如何解决它?