Do we need a time-out in D evolution?
Sean Kelly
sean at f4.ca
Sun Jun 10 08:02:35 PDT 2007
gareis wrote:
> Sean Kelly wrote:
>>
>> I'll admit that one of my reservations about 'const' is the need to
>> potentially write twice as many class methods. I don't suppose
>> there's any way around this?
>
> Either you need to modify your function's parameter, in which case you
> can't write a const version, or you don't need to modify your function's
> parameter, in which case you just pass it in as const.
>
> So how do you need to write additional methods?
class MyClass
{
const char[] slice() const { ... }
char[] slice() { ... }
}
Sean
More information about the Digitalmars-d
mailing list