The Status of Const
Michel Fortin
michel.fortin at michelf.com
Mon Aug 16 16:52:58 PDT 2010
On 2010-08-16 19:06:56 -0400, "Simen kjaeraas" <simen.kjaras at gmail.com> said:
> Uhm, it works in D:
>
> class C {}
> class D : C {}
>
> void main( ) {
> D[] a;
> C[] b = a;
> }
Then that's a bug because it'd allow you to do this:
void main() {
D[] a = new D[1];
C[] b = a;
b[0] = new C;
// what is the type of a[0] now? Certainly not a D.
}
This would be fine however:
const(C)[] b = a;
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list