Is there some tutorial out there that teaches how to:
Make classes and subclasses
Make a function override a function of the superclass
For example, i might try to write a simple 2d game thing. I want to have a class called entity or ent for short which has Draw and Think functions, and in the main program have a vector or array or something of entities and every frame call certain/all entities think and paint functions. Now, it won't be much use if I only have an entity, so I would make many subclasses of Entity such as player and Target and Gun and Moose (:v:) etc. Now, I need to know how to make a subclass of entity, and how to override paint and think.
(PS: isn't is so annoying when you forget to put a post icon and it stops you from posting, then you make one and try to post and it says you must wait 10 seconds?)
I think you want to learn inheritance. Inheritance allows you to make a new class and inherit another class, which will allow your new class to use the protected and public members of the inherited class. I think to override certain functions, you can just redefine them in your new class.
Here is some more information that should help you: [url]http://www.cplusplus.com/doc/tutorial/inheritance/[/url]
Thank you.
Sorry, you need to Log In to post a reply to this thread.