• Advertisement
Sign in to follow this  

template inheritance problem

This topic is 3641 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Aside from missing ;'s at the end of your class definitions, the code you have seems fine.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement