tags:

views:

35

answers:

1

$3.5 - "In addition, a member function, static data member, class or enumeration of class scope has external linkage if the name of the class has external linkage."

Any inputs on what does it mean by 'if the name of the class has external linkage'?

Is the hint on 'local classes' (which probably don't have any linkage) as compared to class defined in namespace scope, and namespace scope classes defined with static specifier (which have internal linkage???)?

+1  A: 

Local classes (but not necessarily nested classes) don't have linkage. A class can't be defined with static specifier. So this equivalently could be stated as follows:

$3.5 - "In addition, a member function, static data member, class or enumeration of class scope has external linkage unless the containing class is a local class or is a directly or indirectly nested class within a local class."

usta
what about 'typedef struct {} A;' at namespace scope. What linkage does it have?
Chubsdad
@Chubsdad: External linkage. 3.5/4: "A name having namespace scope has external linkage if it is the name of ... a named class (clause 9), or *an unnamed class defined in a typedef declaration* in which the class *has the typedef name for linkage purposes* (7.1.3)"
usta
Interesting....
Chubsdad