Jump to content
  • Advertisement
Sign in to follow this  
Asuralm

template inheritance problem

This topic is 3853 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
This is likely unrelated, but you should not have semicolons after function bodies.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!