#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;
}
The code is additionally in the picture just to show the problem clearly. I click fun()
in main
. I get an error saying "Symbol not found: fun". How do I fix it?