Think of a room. Your room might have a table, a bookshelf, your computer, walls, lighting, etc , but the actual "room" isnt a single physical object, its an abstract idea. Another common example...
Type: Posts; User: goldz
Think of a room. Your room might have a table, a bookshelf, your computer, walls, lighting, etc , but the actual "room" isnt a single physical object, its an abstract idea. Another common example...
Ok, well here's my situation. My base class is Item, and the derived classes (for now) are armor and weapons, although i do plan on adding other types(potions,scrolls,etc). The unrelated class is...
cout<< "" <<number1<< " multiplied by " << number2 << "equals" (number1 * number2);
treat (number1 * number2) using the same technique as you did with your other variables, number1 and number2
hrmm...my base class and derived classes don't conflict at all, the problem I'm having is that my two derived classes are different from eachother, and so they have different functions. So, lets say...
RTTI is enabled in borland and I cant find anything else that seems relevant casting or specifically dynamic_cast in the help manual or on their website. The only reason I'm using dynamic_cast here...
thx, that worked and actually makes alot more sense. Strangly, the book im reading (teach yourself c++ in 21 days (lol yea right)) says otherwise. Also, does anyone know why this runs fine on VC++...
My compiler is outputting the following error: "cast from base to derived requires dynamic_cast or static_cast" even though im declaring a dynamic cast about 2 lines before. Here's my basic setup
...
thx for the replies....for some reason I'm having a hard time getting a good grasp of referrers/pointers etc, most everything else has come w/ relative ease to me and I have been able to get it by...
Everything seems to compile fine, but I'm getting a run-time error. What I don't understand is these are identical, the only difference being one is accessing an object directly and the other is...