Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio .NET
Visual C++
C/C++ Build Errors
 Compiler Error C2352
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
Visual C++ Concepts: Building a C/C++ Program
Compiler Error C2352

'class::function' : illegal call of non-static member function

A static member function called a nonstatic member function. Or, a nonstatic member function was called from outside the class as a static function.

The following sample generates C2352:

// C2352a.cpp
class CMyClass
{
public:
   static void func1();
   void func2();
   static void func3()
   {
      func1();   // OK, calls static func1
      func2();   // C2352, calls nonstatic func2
   }
};

int main()
{
}

The following sample generates C2352:

// C2352b.cpp
class MyClass
{
public:
   void MyFunc()
   {
   }

   static void MyFunc2()
   {
   }

};

int main()
{
   MyClass::MyFunc();   // C2352
   // try the following line instead
   // MyClass::MyFunc2();
}
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker