### Scope of Identifier Visibility in C++

The area of the code where an identifier is visible is referred to as the scope of the identifier. The four kinds of scope are:

- Local
- Function
- File
- Class

The scope of a name is determined by the location of the name's declaration.

A type name first declared in a function return type has file scope. A type name first declared in a function argument list has local scope.

A function name that is first declared as a friend of a class is in the first nonclass scope that encloses the class.

If the friend function is a member of another class, it has the scope of that class. The scope of a class name first declared as a friend of a class is the first nonclass enclosing scope.

Scope of Class Names

Local Scope
Function Scope
File Scope
Class Scope
Friend Scope
Member Scope