在 c++ 中使用继承和泛型,这个问题出现在我面前: 这是我的抽象基类
template<class Type>
struct A
{
Type info;
};
template<class Type>
class base
{
protected:
A<Type>* ptrA;
public:
virtual void func(Type X) = 0;
void func(Type X)
{
ptrA->info = x; //no Errors occured
}
};
这是派生的
template<class Type>
class derived : class base<Type>
{
public:
void func(Type X)
{
ptrA-> info = x ; // this is the problem
}
};
问题出现在派生类的函数定义处:我无法访问 成员 ptrA refrenced,,, 任何帮助,请