編譯器錯誤 C2245
將不存在的成員函式 'function' 指定為 friend (成員函式簽章不符合任何多載)
編譯器找不到指定為 friend 的函式。
下列範例會產生 C2245:
// C2245.cpp
// compile with: /c
class B {
void f(int i);
};
class A {
int m_i;
friend void B::f(char); // C2245
// try the following line instead
// friend void B::f(int);
};
void B::f(int i) {
A a;
a.m_i = 0;
}