Sign in to follow this  
Asuralm

template inheritance problem

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this