c++ - 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 引用的成员,请提供任何帮助
解决方案
推荐阅读
- java - 接口是否提供完整的抽象?如何?
- bash - 如何使用环境变量集自动调用脚本
- php - 当 laravel 中的单元测试失败时,响应不是视图消息
- sql - 连接两个表后使用 NOT IN 关键字
- python - 获取名称错误名称'sentence_stream'未定义
- c# - WFA 如何获取文本框中插入符号所在的行号
- python - 用贝塞尔曲线形状检测矩形和项目之间的碰撞
- c# - 在“使用”语句中从函数返回资源实例与在“使用”语句中直接实例化资源相同吗?
- powershell - 系统搜索超时
- javascript - 在console.log中使用逗号时是否可以调用toString(自定义打印)