P
Pawel_Iks
I have following class definition (A.h file):
class A
{
public:
int N;
int count1(int n) {n++;}
int count2(int n) {n+=5;}
int otherFun(int n, int (*fun)(int));
}
and I want to implement otherFun method (in A.cpp file):
int A:therFun(int,int (*fun)(int))
{
int c=0,d;
d=fun(c);
}
and call it (in main.cpp):
int main()
{
A obj=A();
int t;
A.N=12;
t=A.otherFun(N,test.count1);
return 0;
}
and it doesn't work ... I have two questions:
1) If there implementation of otherFun method is correct, and when
it's correct how can i call this method in main() function?
2) why it doesn't work? (for simply function - not class member - it
works fine)
class A
{
public:
int N;
int count1(int n) {n++;}
int count2(int n) {n+=5;}
int otherFun(int n, int (*fun)(int));
}
and I want to implement otherFun method (in A.cpp file):
int A:therFun(int,int (*fun)(int))
{
int c=0,d;
d=fun(c);
}
and call it (in main.cpp):
int main()
{
A obj=A();
int t;
A.N=12;
t=A.otherFun(N,test.count1);
return 0;
}
and it doesn't work ... I have two questions:
1) If there implementation of otherFun method is correct, and when
it's correct how can i call this method in main() function?
2) why it doesn't work? (for simply function - not class member - it
works fine)