CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 1999
    Location
    Israel
    Posts
    42

    static member function

    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.


  2. #2
    Join Date
    Apr 1999
    Location
    Seattle, WA
    Posts
    74

    Re: static member function

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured