I have went through the following question, requiring the number of arguments from a member function takes.
For example:
struct A {
int one(int);
int two(int, int);
int two(float, float);
};
so what we have is:
test(&A::one) = 1
test(&A::two) = 2
YOU R MY IDOL...
I was totally sucked with these problems.
I was a fu**ing PHD student and wanted take some software programmer jobs from the industry.
You no wat. I found the entire knowledge I learnt from my phd degree doesnot work out.
IT JUST DOESNOT WORK!
SORRY...a little bit overexcited.
anyway, thx MAN
#include<iostream>
usingnamespace std;
struct A {
int one(int);
int two(int, int);
int two(float, float);
};
int test(int (A::*a)(int)){ return 1; }
void main()
{
int a=2;
a = test(&A::one);
system("pause");
}
That is the code i wrote for the first question.
However, the compiler gave me the following errror: unresolved external symbol "public: int __thiscall A::one(int)" (?one@A@@QAEHH@Z) referenced in function _main
This is because one has a declaration but no definition. To get a pointer to a function you need that function to be defined. You can just replace the ;s on lines 5, 6 and 7 with {return 0;}