Lazy upcasting

Denis Golovan denis at remove.me.azovprom.com
Tue Mar 27 01:13:24 PDT 2007


Hi, all!

>> void main() {
>> //                             ...ok...      ...ok...        ...ups!
>> SpecificStorage1 s1 = (new SpecificStorage).param2(true).param1(5);
>>}

As far as I understand, this breaks strict type-checking of the language.

However, things like overriding virtual function with params/return types 
changed to subclasses, IMHO, is worth to consider. Indeed, it shortens 
overriding of semantically same methods.

As for object factory function, it seems that is used for hiding subclasses, 
so, IMHO, it don't need downcasts at all.


 





More information about the Digitalmars-d mailing list