I've been stuck on one thing for couple hours and I can't get my head around this. My friend said it's possible and since I have no idea how you call this in c++, I don't know how to google this. hehe
What I'm trying to do is create a class, that is being inherited by nearly all classes in my game. That class will have empty run function, and I want each class that inherites that class, to have their own version of run function that runs totally different code then other classes.
here's a drawing (really bad one) to help it explain:
the lines represent inheritance

What I'm trying to achieve is command system. For example if i type in into command /setWeather Rain. It would run that function from weather and it would start raining in my game. Etc. Hope I explained this well hehe
Here's part of my code just in case:
[source lang="cpp"]class CommandC{public: CommandC(); ~CommandC();void *parent;char* command; void run(){};};[/source]
Thanks for taking your time and help
Edited by iLoveGameProgramming, 15 June 2012 - 01:29 PM.






