Data members and member functions cannot be defined as external, although entire objects can. When a member is declared as extern
, the
compiler simply ignores the keyword, making it both extraneous and confusing.
Noncompliant code example
class C {
void fun();
};
extern void C::fun() { // Noncompliant
}
Compliant solution
class C {
void fun();
};
void C::fun() {
}