Generics and Derived Classes .NET 3.5

Posted by Achilles on Stack Overflow See other posts from Stack Overflow or by Achilles
Published on 2010-06-03T19:42:34Z Indexed on 2010/06/03 19:54 UTC
Read the original article Hit count: 194

Filed under:
|
|

Consider the following where class "Circle" inherits from "Shape":

dim objListOfCircles as new List(of Circle)

DrawShapes(objListOfCirlces)


Private sub DrawShapes(byref objListOfShapes as List(of Shape))

for each objShape as Shape in objListOfShapes
  objShape.Draw()
next 

end sub

I can't get this to work. What is the explaination as to why this doesn't work?

© Stack Overflow or respective owner

Related posts about generics

Related posts about .net-3.5