Hehe..... one question, how to do pointer to a function into a c++ class?
I tried:
class lala
{
int f1(int, int);
int f2(int, int);
int (lala::*pf)(int, int);
};
int lala::f1(int a, int b)
{
return a+b;
}
int lala::f2(int a, int b)
{
return a-b;
}
void main()
{
lala l;
int a = 5, b = 6, c, d;
l.pf = l.f1;
c = l.pf(a, b); //ERR: term does not evaluate to a function
l.pf = l.f2;
d = l.pf(a, b); //ERR: term does not evaluate to a function
printf("Res: %d %d\n", c, d);
}
TXS!!!!
I tried:
class lala
{
int f1(int, int);
int f2(int, int);
int (lala::*pf)(int, int);
};
int lala::f1(int a, int b)
{
return a+b;
}
int lala::f2(int a, int b)
{
return a-b;
}
void main()
{
lala l;
int a = 5, b = 6, c, d;
l.pf = l.f1;
c = l.pf(a, b); //ERR: term does not evaluate to a function
l.pf = l.f2;
d = l.pf(a, b); //ERR: term does not evaluate to a function
printf("Res: %d %d\n", c, d);
}
TXS!!!!