Tableau de pointeurs de fonctions
Bonjour,
Dans le cadre d'un programme en C++, l'utilisation d'un tableau de pointeurs de fonctions me serait d'une grande utilité!
Et j'ai pensé à aller voir ici avant de poster : http://www.developpez.com/c/megacours/x2012.html
Dans un namespace Raws, je vais définir les fonctions qui seront pointées ...
Comme suit :
Code:
1 2 3 4 5 6 7 8 9
|
namespace Raws
{
int Co(wxString f,wxString t,wxString a)
{
wxMessageBox("Co a été exécutée");
return 1;
}
}; |
Et donc je fais cela pour déclarer et initialiser mon tableau :
Code:
1 2 3 4 5 6 7
|
using namespace Raws;
typedef int (*pfunc)(wxString,wxString,wxString);
pfunc t[150];
t[0] = &Co ; |
Et voici l'erreur sortie droit du compilo (je suis sous dev-c++, donc mingw) :
Citation:
12 C:\Alp\wxcpp\functable.h expected constructor, destructor, or type conversion before '=' token
12 C:\Alp\wxcpp\functable.h expected `,' or `;' before '=' token
La ligne 12 étant :
Si vous pouviez m'aider à résoudre ce problème, je vous en remercierai énormément...
Alp