Click to See Complete Forum and Search --> : static member function


slepax
September 23rd, 1999, 06:17 PM
I'm trying to define a class member function as static. When the class is defined in the .h and the implementation is in the .cpp. I keep getting the following error:
"...error C2724: 'WndProc' : 'static' should not be used on member functions defined at file scope"

Why ?

When writing the implementation in the class, the error does not occur.

Again, why ?


TIA, Ronen.

Lane Galloway
September 23rd, 1999, 06:24 PM
It sounds like you are using the word "static" in your cpp file.

Inside your class definition, put


static int foo();




In the cpp file, put


int MyClass::foo()
{
.
.
.
}




If that's not the solution to your problem, please provide examples of what you are doing.