const member function synatx?

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sat Feb 16 06:13:52 PST 2008


Janice Caron wrote:
> It is unusual ever to need to return a const(ReturnType), since why
> would you want to prevent the callee from modifying their copy of the
> return value?

How about returning a class reference that you still have your own copy to?
One common example of this might be getters for properties of class 
type, especially if the class instance is part of the internal state of 
the owning class and shouldn't be modified without going through the 
methods of the owner.



More information about the Digitalmars-d mailing list