Hey, i'm making my final text rpg before I move onto direct x and i'm making great progress. I have created an inventory class and a vetor to hold Weapon objects. Now, the question I have to ask is: If I have created multiple classes that inherit all of Weapon's data members and functions(classes would include Sword, Bow, and Staff), would I be able to fill the vector with those classes?
Ex:
thanks.Code:vector<Weapon*> m_Weapons; void addW(Weapon* pWeapon); { m_Weapons.pushBack(pWeapon); } Inventory.addW(Sword)<-i have no idea how i would add in a sword object, would i have to cast? I really don't know...



LinkBack URL
About LinkBacks



Want to add some