Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Using inheritance

Author
Message
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 21st Apr 2009 03:43 Edited at: 21st Apr 2009 03:45
Im trying to get inheritance working but idk how, i want to know how to use the base class's constructor in the class that inheritits it, but also let the class that inheritits it have its own constructor, but idk how, heres my code so far:

t_entity.h:


t_entity.cpp:


US_Soldier.h:


US_Soldier.cpp:


Any help would be greatly appreciated
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 21st Apr 2009 04:24 Edited at: 21st Apr 2009 04:31
US-Soldier.h


US_Soldier.cpp


All I did was add in the parameters for a basic t_entity object into the US_Soldier constructor and then (the important part) passing those parameters into the t_entity constructor like so:

Plus I got rid of this:

It should work, I haven't tested it or anything and there might be a few typos, but i'm somewhat sure that this is how to do what you are trying to do.

EDIT: Wow, found LOTS of typos! But now they're fixed and I even tested it out!

#ifdef _DEBUG
FixBugs(All);
#endif
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 23rd Apr 2009 06:21
Thanks mate this is really helpful

Login to post a reply

Server time is: 2024-09-30 23:11:07
Your offset time is: 2024-09-30 23:11:07