相关疑难解决方法(0)

什么时候应该明确使用`this`指针?

我什么时候应该明确地写this->member一个类的方法?

c++ this

88
推荐指数
8
解决办法
3万
查看次数

模板继承c ++

我是c ++的新程序员.我第一次使用模板.

我有一个抽象类和另一个扩展它的类.但是抽象类的所有受保护成员都不被其他类识别:

class0.h:

template<class T>
class class0 {

protected:
    char p;
public:
    char getChar();
};

**class1.h**
template<class T>
class class1:public class0<T> {
public:
    void printChar();
};
template<class T>
void class1<T>::printChar(){
    cout<< p<<endl;//p was not declared in this scope
}
Run Code Online (Sandbox Code Playgroud)

谢谢.有一个伟大的一周=)

c++ inheritance templates

16
推荐指数
2
解决办法
2万
查看次数

标签 统计

c++ ×2

inheritance ×1

templates ×1

this ×1