given a class like
class Person{
public:
int age;
string name;
Person( int i, string n ):age(i), name(n){}
};
If we have a global class member pointer, we can do something like this:
int Person::*class_member_ptr;
class_member_ptr = &Person::age;
But what if we wanna do the same thing in a function, what is the function signature, and how do we pass Person::age into this function such that:
void func( Person::age ){
class_member_ptr = &Person::age;
}
the data type of the argument in the func() is wrong. it can't be compiled. How do we make the data type of the argument right?