template inheritance problem

Started by
3 comments, last by Zao 16 years, 1 month ago
Hi all: I have a problem to use the inheritance of the template class. The base class is look like:


template <class T>
class plane{
public :
    plane() {};
protected:
...
};




The derived class is :

template <class T>
class triangle : public plane<T>{
public:
    triangle() : plane<T>() {};
...
protected:
...
};


However, I got an error complaining that

'triangle' is not a template type
forward declaration of 'const class triangle'


Also, when I tried to call the function writen in plane class from triangle class, there is an error of undefined reference. What's the problem please? Thanks
Asura
Advertisement
Aside from missing ;'s at the end of your class definitions, the code you have seems fine.
No, it's not the problem of missing ";".
Asura
Critical thinking skill: if the code you posted doesn't contain the problem, then the problem is probably somewhere in the code you didn't post.
This is likely unrelated, but you should not have semicolons after function bodies.

To make it is hell. To fail is divine.

This topic is closed to new replies.

Advertisement