template inheritance c++

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 =)

16
задан yonka 26 September 2010 в 19:45
поделиться