On Monday 24 January 2011 06:02:13 Simen kjaeraas wrote:
> Trass3r <u...@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();

Not quite right. The return value is _not_ const in this case. It's only the 
function which is affected. Try it and you'll see. The _only_ time that a 
return 
value is const or immutable is if you use parens to mark it that way.

- Jonathan M Davis

Reply via email to