Explicit Access Qualification

From RAD Studio
Jump to: navigation, search

Go Up to C++ namespaces Index

You can explicitly qualify each member of a namespace. To do so, you use the namespace identifier together with the :: scope resolution operator followed by the member name. For example, to access a specific member of namespace ALPHA, you write:

      ALPHA::LD;  // Access a variable
      ALPHA::f;   // Access a function

Explicit access qualification can always be used to resolve ambiguity. No matter which namespace (except anonymous namespace) is being used in your subsystem, you can apply the scope resolution operator :: to access identifiers in any namespace (including a namespace already being used in the local scope) or the global namespace. Therefore, any identifier in the application can be accessed with sufficient qualification.

New-style typecasting

This section presents a discussion of alternate methods for making a typecast. The methods presented here augment the earlier cast expressions (which are still available) in the C language.

Types cannot be defined in a cast.

See Also