Sign in to follow this  
DBurgener

C++ Inheritance Problem with Allegro

Recommended Posts

DBurgener    100
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
DBurgener    100
[quote name='bbobak' timestamp='1310869924' post='4836225']<br />You need to include the header that contains the Sounds class before inheriting it in Monster.<br />[/quote]<br /><br /><br />

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

Share this post


Link to post
Share on other sites
rip-off    10976
[quote name='SimonForsman' timestamp='1310873844' post='4836242']
You might want to reconsider your design, does it really make sense to use inheritance here (Is a Monster a Sound ?)
[/quote]
QFE

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