Compartir a través de


Names

identifier 
qualified-name 
operator-function-name 
conversion-function-name 
~ class-name 
template-identifier 
template name 
qualified-class-name :: template name

Remarks

Any identifier that has been declared is a name. A qualified name is a name composed with the scope resolution operator. See qualified names.

An operator-function-name is a name that is declared in the form

operator operator-name**(** argument1 [ , argument2] );

See Overloaded Operators for more information about declaration of operator-function-name.

A conversion-function-name is a name that is declared in the form

operator type-name**(** )

Note

You can supply a derivative type name such as char * in place of the type-name when declaring a conversion function.

Conversion functions supply conversions to and from user-defined types. For more information about user-supplied conversions, see Conversions.

A name declared as ~ class-name is taken as the "destructor" for objects of a class type. Destructors typically perform cleanup operations at the end of an object's lifetime. For information on destructors, see Destructors.

There are also several forms of names used for template types and template functions.

Template identifiers include the template class name followed by angled brackets enclosing the template argument list, which may include types and expressions, depending on how the template was declared. Examples of template-identifers are:

A<int> // class A takes a type as a template argument
A<int, char> // class A takes two types as template arguments
A<4> // class A takes an int as a template argument
A<> // class A is a template with a default argument

Qualified names of template functions may include the template keyword. The template keyword is not allowed in a name unless preceded by the scope resolution operator, the -> operator, the . operator, or a qualified name. The following are names of functions:

::template f<int> // f is a global template function
A::template g<100> //g is a template member function of class A

Similarly, the name of a class template can be specified using the template keyword if preceded by scope resolution or qualified name. The following are names of types:

::template A<int> // equivalent to A<int>
Outer::template Inner<int> // equivalent to Outer::Inner<int>

For more information on templates, see Templates.

See Also

Reference

Primary Expressions