【发布时间】:2018-12-02 19:09:22
【问题描述】:
我无法从专门的模板类中访问定义在模板类中的成员数据“值”。为什么? 有人可以帮助我吗? 谢谢
template <class T>
class A {
public:
int value;
A() {
value = 0;
}
};
template <> class A<int> {
public:
A() {
value = 3; // Use of undeclared identifier 'value'
A::value = 3; // No member named 'value' in 'A<int>'
this->value = 3; // No member named 'value' in 'A<int>'
}
};
【问题讨论】:
标签: c++ template-specialization template-classes