Muokkaa

Jaa


Compiler Error C2255

'element' : not allowed outside of a class definition

For example, a nonmember function is declared a friend.

The following sample generates C2255:

// C2255.cpp
// compile with: /c
class A {
private:
   void func1();
   friend void func2();
};

friend void func1() {}   // C2255
void func2(){}