Inheritance of purity
timon.gehr at gmx.ch
Sat Feb 18 13:18:49 PST 2012
On 02/18/2012 10:06 PM, deadalnix wrote:
> Le 18/02/2012 16:04, Timon Gehr a écrit :
>> For them, it is certainly safe. It is questionable how large the
>> effective benefit is for const, since the const qualifier would be
>> inherited for the method only, but not for its parameters.
> The const qualifier does NEVER qualify a function. This is a
I don't care whether or not it is a misconception. It is how the
language is defined. If you want to change this, file an enhancement
> In what we call const function, what is const is the
> hhidden parameter "this", not the function.
Both are const. Ask the compiler.
In fact, the incident that the method is const is what enables
contravariant overriding of mutable/immutable by const methods. (This is
not supported for the explicit formal parameter types.)
More information about the Digitalmars-d