sorrow@oak.circa.ufl.edu (06/17/91)
I am writing a game in C++ and am using an object hierarchy like this: Object -> Weapon -> Container -> Armor -> etc. etc. I have some functions, such as for the Character class, that are defined as: int Character :: GetObject ( Object &obj ) { } Is there a way to determine what type of object was passed? The Object class is a pure abstract class. I am currently using a bit mask a la: if (Obj.type&OT_WEAPON) dosomething(); else if (Obj.type&OT_CONTAINER) dosomething(); etc. etc. Anyone have any ideas? Also, I would like the ability for some things to inherity from multiple types of objects: Container -- | ---- Backpack of Shielding | Armor __ Any help would be appreciated. Brian /* Brian Hook -- MS-DOS Programmer for Contract ----------------------------------------------------------------- "Seamus, that's my dog...I saw her today at the reception...sorry, sixTEEN inches....better save the women and children first...but this one goes to 11! ..anymore of that plutonium nyborg?....there can be only ONE!....like a finger pointing to the moon....ease the seat back...one day closer to death */