c++模板使用问题请教
class audio
{
public:
void my_print(){ cout<<" hello!\n"<<endl;};
protected:
int a;
};
template<typename T>
class test
{public:
bool dowork(const std::string &json, T &item);
};
template<typename T>
bool test<T>::dowork(const std::string &json, T &item)
{
item.my_print();
}
调用方式
test<audio> myobject;
myobject(str, audio);
dowork不能调用my_print 么,怎么做才能调用,多谢各位大神