Jump to content
  • Advertisement
Sign in to follow this  
DBurgener

C++ Inheritance Problem with Allegro

This topic is 2560 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

I am having an issue with inheritance. I want my "Monster" class to inherit from my "Sounds" class. In my "Monster" header i put

class Monster: public Sounds
{
.........
}


When I run the program I get the error "error C2504: 'Sounds': base class undefined."

The program runs fine if I don't try to inherit Sounds. I am using Microsoft Visual C++.

Share this post


Link to post
Share on other sites
Advertisement
<br />You need to include the header that contains the Sounds class before inheriting it in Monster.<br />
<br /><br /><br />

HOLY CRAP!!!! I can't believe I missed that. Thanks!

Share this post


Link to post
Share on other sites

You might want to reconsider your design, does it really make sense to use inheritance here (Is a Monster a Sound ?)

QFE

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!