Alrighty, so.

I have an (abstract) class named BaseObject, whose purpose is just to be extended upon. Next, I have a VisualObject class, which inherits from the BaseObject class. Next, I have a Player class, which inherits from the VisualObject class and the BaseObject class (through the VisualObject class).

The thing is, I am currently looping through a list of BaseObjects (which get added to the list when I create an instance of the Player or VisualObject class) and trying to find out if the object I have looped into is a Player class. That part is simple; I have been able to identify which BaseObject in the list corresponds to a Player object.

The part I'm having trouble with is that I have another class, TileMaster, who wants to change the coordinates of the instance of the player identified through the previous loop, but the BaseObject class doesn't have x or y variables, but the Player (and VisualObject) do.

The way that I have the engine set up, I am unable to just reference the Player object itself; It is being created by another object in a different part of the program.

Here is some code to help identify what I am trying to do:

Code:
BOOST_FOREACH (BaseObject* object, baseObjects) //loop through the list
{
	// if the variable set in the BaseObject is a Player set number
	if(object->objectType == 2)
		 // allow the tile master to change properties of the Player by ONLY knowing the BaseObject. Problems here
		tilemaster->SetPlayerPos(object, THE_X_I_CHOOSE, THE_Y_I_CHOOSE);
}
Player.cpp:
Code:
Player::Player(int numPlayer) :
	VisualObject("media/player.png"),
	thisPlayerNum(numPlayer),
	isMoving(false),
	isJumping(false),
	objectType(2) // identifies that the object type looped through is a player
{
//...
}
VisualObject.cpp:
Code:
VisualObject::VisualObject(const std::string& filename) :
		BaseObject(),
		surface(NULL),
		x(0),
		y(0),
		objectType(1) // identifies it as a VisualObject
{
// ...
}
BaseObject.cpp:
Code:
BaseObject::BaseObject() :
	objectType(0)
{
// ...
}
Any ideas?