Transitive const sucks
James Dennett
jdennett at acm.org
Wed Sep 12 22:06:46 PDT 2007
Walter Bright wrote:
> Janice Caron wrote:
>> It's a solution which doesn't scale.
>>
>> And there goes encapsulation...
>
> At least for this example, the same issue exists when attempting to do
> "const-correctness" in C++.
No, it doesn't. C++ doesn't hide the references from you
with its syntax, but the const Rectangle having a reference
to a Raster would *not* imply constness of that Raster in
C++. (Indeed, this is a fairly common situation, whether
Raster is held by reference or some kind of pointer.)
> You cannot paste const on at the top level,
> it has to be put in at every level underneath it.
I'm not sure what you mean by that. There's not much
context in which to interpret it.
-- James
More information about the Digitalmars-d
mailing list