i am a new programmer in c++. and i am using templates for the first time.
i have an abstract class and another class extending it. but all the protected members of the abstract class are not recognised by the other class:
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
}
thank you. have a great week =)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…