Jump to content
  • Advertisement
Sign in to follow this  
caseyd

OOP - Missing Link?

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

Hello all. I have been programming off and on for a few years now, mostly in C/C++ for the last couple. I seem to be missing the ability to program a game in an object oriented fashion. I think what is really hindering my ability to do this is that I don't have a clear understanding of the way in which these classes should interact with each other. Most of the time when I try and use classes, I get a set of classes that are being used in a procedural way. Any thoughts on how to get over this? I understand the basics of OOP but seem to not be able to get to that next level. Thanks ~Casey~

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Surely you could have something like

Character::

and

Weapon::

and

Level::

then have the Character:: interact with Level::

???

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Understanding how 'virtual' enables you to eliminate the vast majority of 'if-then-else' and 'switch' statements would do you some good. That understanding helped me immensely. I do not know if the word 'immense' is great enough to properly express what I mean. 'virtual' is *VERY* powerful.

Instead of something like:

fireWeapon(Weapon * w) {
switch (w->type()) {
case Weapon::Gun:
fireGun();
break;
case Weapon::laser:
fireLaser();
break;
...
you do something like:
weapon->fire();
The simplification is enormous.

Share this post


Link to post
Share on other sites
http://www.gamedev.net/community/forums/topic.asp?topic_id=366513

pretty recent, aloy, hope it clears something up for you as it did for me.

=)

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!