const/immutable member functions
Simen kjaeraas
simen.kjaras at gmail.com
Mon Jan 24 06:02:13 PST 2011
Trass3r <un at known.com> wrote:
> class F
> {
> const Foo bar();
> }
>
> Isn't this ambiguous? "returns a const Foo object" vs. "is a const
> member function that returns a Foo object"?
Only to humans. const applies to everything after it, unless there
are parentheses. In this case, 'everything' is Foo bar();
I do agree it is ambiguous though, and should be disallowed, or at
very least, discouraged.
--
Simen
More information about the Digitalmars-d
mailing list