grep
Robert Fraser
fraserofthenight at gmail.com
Sat May 10 01:12:04 PDT 2008
Dee Girl wrote:
> janderson Wrote:
>
>> //ie
>> class A
>> {
>>
>> };
>>
>> class B : A
>> {
>>
>> };
>>
>> B[] b;
>> b ~= new B;
>> A[] a = b;
>> a ~= new A;
>> //b[1] Is not an A type (not a B type), but is essentially a reinterpret
>> A -> B.
>
> Your example compiles but it was so good if it did not. Modifiable arrays should never be covariant! Why did D make the same mistake that Java and Eiffel did? Newer languages should learn from the mistakes of the old languages. This is more than a bit disappointing. Dee Girl
Java learned its lesson in 1.5... List<B> can't be cast to a List<A>
implicitly, only to a List<? extends A>.
More information about the Digitalmars-d
mailing list