Enclosing scope is not necessary is a local scope. For example the global namespace is an enclosing scope for all declarations.:)
The local scope is the block scope. But names can be defined in other scopes as for example namespace scopes, function prototype scopes or function scopes.
@Anmol444
What do mean global namespace is an enclosing scope?
This means that all declarations are enclosed in the global namespace. Any namespace is enclosed in the global name space. For example
namespace outer
{
namespace inner
{
}
}
Here the both namespaces are enclosed in the global namespace. Also namespace inner is inclosed in namespace outer.
Any function declaration are enclosed in some namespace.
Any local scope is enclosed in a block scope.
You can say about enclosing scope relative to some declaration. There is no such entity as enclosing scope without some other enity that is enclosed.:)
As I showed above in this example
namespace outer
{
namespace inner
{
}
}
You can say that outer is enclosing scope only relative to scope inner. So any local scope is enclosing scope relative to all declarations that are done in this scope except declarations with external linkages. But the enclosing scope does not equivalent to the local scope as it is shown from the presented example with namespaces.