Eh, this may be kinda stupid, but I have the traditional setup:
class tile {
// ...
};
class tilePlayer : public tile {
// ...
};
At one point in my code I had a pointer to a tile instance and I wanted to access it as a tilePlayer instance. So I tried something like this:
// map is an array of pointers to tile instances
(tilePlayer*)map[ index ]->PlayerSpecificFunction();
This didn't compile ( "PlayerSpecifcFunction not member of tile" ) so I tried this and it worked:
tilePlayer* p = (tilePlayer*)map[ index ];
p->PlayerSpecificFunction();
Isn't the latter just the same as the former but with more steps? Or am I messing up the syntax?