cast a LinkSeq

Qian Xu quian.xu at stud.tu-ilmenau.de
Mon Apr 6 10:33:17 PDT 2009


Adam Burton wrote:
> I wouldn't think so, cos LinkSeq!(Apple) does not inherit LinkSeq!(Fruit), 
> they are 2 separate types. However your apples automatically downcast (or 
> up, depending which way you like to draw your diagrams :-) ) so unless you  
> intend to pass the LinkSeq!(Apple) into a function expecting LinkSeq!(Fruit)  
> it shouldn't be a problem. If you are passing about LinqSeq!(Fruit) and want  
> your LinkSeq!(Apple) to fit you might need to write some adapters and make 
> use of the models available to you or something along them lines.
> 
> That's my understanding anyway.

> 

yes. I can cast all Apple-object to Fruit-objects one by one. I hope 
there is an one-line-solution :-)

-- 
Xu, Qian (stanleyxu)
  http://stanleyxu2005.blogspot.com


More information about the Digitalmars-d-learn mailing list