Advertisement

I have learned more and is it now possible...

Started by April 22, 2002 12:24 AM
10 comments, last by code_fx 22 years, 7 months ago
OOP.

Have a class for lack of a better word called ''object''

Now the class will have several data elements, (such as location, orientation, and something like a state of whether it is being modified in any way) but it would most benefit you to have them virtual at this level. Have this be your base-class.

Now to have a chair, you would have this be a derived class that overrides the virtual data elements into something you can use, you do this so that you can have an even higher class for specific types of chairs, like recliners, dinner chairs, or whatever, and have them use their own overridden data elements and methods (like a recliner can recline, or you could be able to break the dinner chair over some poor fools head). This way you have the same methods to access each higher-level object, and the object handles how it is displayed, how it can be used, or whether it can affect other objects.

You can also use the base-class to make other objects like sofas. These have a location, orientation, and a state of being modified, but they differ from chairs because more than one person can me using it at one time (and more than likely wouldn’t be able to be moved easily in the game).

Anyways, I’ve rambled on enough about this. For a better understanding of OOP, check out a book called C++ How to Program by Harvey M. Deitel and Paul J. Deitel.





If at first you don''t succeed, use profanity and try, try again.
If at first you don't succeed, use profanity and try, try again.
quote: Original post by elis-cool
I think DrPizza and Sabreman would have something to say about that...


If they have then they obviously like to argue for the sake of it. Before we get started remember that he said "MORE OR LESS".

-------------Ban KalvinB !

This topic is closed to new replies.

Advertisement