C++ test, help!

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


ANY IDEA to write the function of "test"?
How about
1
2
int test(int (A::*a)(int)){ return 1; }
int test(int (A::*a)(int, int)){ return 2; }

?
(I didn't test this)
yeap
i tried the above idea.
thats great.
thx a lot
one more questions:
what if i declare a class as a member of another class. For instance, i have:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class MyClass {
    static int n;
public:
    class blank {
    public:
        blank() {++n;};
        ~blank() {--n;};
    };
    friend class blank;
    MyClass (const blank&) {assert(n == 1);}
    ~MyClass () {assert(n == 0);}
    void f() {}
};
int MyClass::n = 0;


the problem is how i can instantiate an instance of MyClass here???
You'd write
1
2
MyClass::blank b;
MyClass m(b);

What is the problem?
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>
using namespace 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

ANY IDEA>
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;}
good job...
last question: where did you learn it from?
Experience, I guess.
:-)
Topic archived. No new replies allowed.