Lets say I have 3 different classes: Equipment, Weapon and Tools. Weapon and Tools inherits Equipment. I created a Weapon or Tool object and added it to a Equipment array. When I retrieve the object, how do I write my “IF” statement to check if this object is a Weapon or Tool?
Thanks
Use dynamic_cast as follows: