You have a slight misunderstanding of member functions.
A member member function does something with (or to) an object of the given type. For example... FA1() in your above code is a member of the A class. Therefore, it would logically do something with an A object.
class A
{
int member;
public:
void set(int v)
{
member = v; // changes 'member' of 'this' object
// ie, this->member
}
};
int main()
{
A example;
example.set( 5 ); // sets because we're calling A::set with 'example'
// 'example' becomes 'this'. Therefore 'example.v' is changed by this line
// this, however, is a compiler error:
A::set( 3 ); // this doesn't make any sense because there's no object. Whose 'v' are we changing here?
// we can't change an object's variable when we don't have an object.
}
This is the problem with your code. You're trying to call an A member function without an A object, which doesn't make any sense.
This is even worse:
1 2
A * x1=0;
x1->FA1();
This makes 'this' a null pointer (ie, you'll be accessing invalid memory -- which will probably crash your program).
If the function does NOT need an object in order to work, then that's when you make the member function static. That's exactly what static member functions are for.