Author: Michel Langeveld
Date: 06:50:23 10/29/03
I have a problem with casting function pointers between two classes.
The error is as follows:
error C2664: 'PGNParse::parse' cannot convert parameter 2 from
void(char *) to 'on_game_function_type'
Is there anybody who has experience in solving this kind of error? Last time I
changed a lot of code to jump over this error, but I'm curious if there is a
nice approach to fix it.
----------- some code out of PGNtoScreen -------------------
void PGNtoScreen::forEachGame(char *moves)
{
cout << moves << endl;
}
void PGNtoScreen::doit(char *strFileName)
{
PGNParse p;
p.parse(strFileName, forEachGame); //gives error C2664
}
----------- some code out of PGNParse -------------------
typedef void (*on_game_function_type)(char *moves);
void PGNParse::parse(char *strTextFile, on_game_function_type on_game)
{
char *all_moves;
....
on_game( all_moves );
....
}
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.