The syntax of elaborated-type-specifier is the same as in C++
(the use of typename
is found in the coming C++ standard
[ANSI95] [Stroustrup95]),
with the addition of signatures [Baumgartner-Russo95],
which are used in Larch/C++ to help specify requirements on template
parameters (see section 8 Template Specifications).
elaborated-type-specifier ::= class-key [::
] [ nested-name-specifier ] identifier |enum
[::
] [ nested-name-specifier ] identifier |typename
[::
] nested-name-specifier identifier |typename
[::
] nested-name-specifier [template
] template-class-instance class-key ::=class
|struct
|union
|signature
An elaborated-type-specifier can by used instead of just the
identifier either for emphasis, or because the identifier
has been used in another declaration that would otherwise hide the name
of the type.
For example in the following, a class Foo
is declared,
along with a variable of that class of the same name.
The variable name makes a hole in the scope of the class name,
hence the elaborated-type-specifier must be used to name the class
in the following code.
// @(#)$Id: elaborated.lh,v 1.1 1997/01/10 23:35:29 leavens Exp $ class Foo { } Foo; class Foo aFoo; // needs elaborated type specifier
Go to the first, previous, next, last section, table of contents.