0

Possible Duplicate:
Inheritance and templates in C++ - why are methods invisible?
Why can't I use variable of parent class that is template class?

I'm trying to use template with inheritance and try to access public member of parent class from child class. But this is not compiling with g++.

template<class T>
class A
{
public:
A<T>* t;
};

template<class E>
class D:public A<E>
{
public:
        D()
        {
                t = 0;
        }
};

int main()
{
        D<int> d;
        return 0;
}

compile error:

g++ Test.C Test.C: In constructor D<E>::D():
      Test.C:27: error: 't' was not declared in this scope
4

0 回答 0