首页 > 解决方案 > IntelliSense '没有可用的成员'

问题描述

在 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 引用的成员,请提供任何帮助

标签: c++inheritancepolymorphismabstract-classintellisense

解决方案


推荐阅读