any news on const/invariant?
Chris Miller
chris at dprogramming.com
Tue Nov 27 11:33:26 PST 2007
On Tue, 27 Nov 2007 13:59:47 -0500, Walter Bright
<newshound1 at digitalmars.com> wrote:
> 2. It enables you to 'group' const member functions:
>
> const
> {
> int foo();
> int bar();
> }
>
> this cleans up things nicely when you have a number of member functions.
> Contrast this with how the same code looks in C++.
The above could be the same as:
int foo() const;
int bar() const;
and this apply to the return type:
const int foo();
const int bar();
When grouping with : or { } it applies to the actual named declarations it
encloses; but if const is applied before the return type, precedence (the
juxtaposition) dictates association with the return type.
This is what I would assume.
More information about the Digitalmars-d
mailing list