const/immutable member functions

Kagamin spam at here.lot
Mon Jan 24 07:54:27 PST 2011


Trass3r 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"?

The const qualifier applies to the member being declared - the function in this case. Usually transitivity rules come into play, but they're not defined for functions.


More information about the Digitalmars-d mailing list