//-----------------------------------------------------------------
// Player class
//-----------------------------------------------------------------
class Player{
int id;
public:
Player(int num) ;
void Print() {
printf("id = %d \n", id);
}
};
class PlayerWrapper {
private:
int id;
Player *_player;
public:
PlayerWrapper(int n)
{
id = n;
_player = new Player(id);
_player->Print();
}
};
//-----------------------------------------------------------------
// Constructor for Player
//-----------------------------------------------------------------
Player::Player(int num) {
id = num;
}
void PlayerPrint(int arg) {
// Complete this function!!
PlayerWrapper *printIt;
printIt= new PlayerWrapper(arg);
}
void ListPrint(List *p) {
p->Mapcar((VoidFunctionPtr) PlayerPrint);
}
//----------------------------------------------------------------------
// ThreadTest
// This is called by the main program.
//
//----------------------------------------------------------------------
List *playerList;
Player *newPlayer;
void
ThreadTest()
{
playerList = new List;
for (int i = 0; i < 10; i++) {
newPlayer = new Player(i);
playerList->Append((void *) newPlayer);
}
ListPrint(playerList);
}
That seems right, any ideas how to fix it? Google proves unhelpful and I can't figure out what I'm doing wrong when comparing it to older working programs.