11 Dec
2009
11 Dec
'09
2:28 p.m.
Hi list, Why can't I make an array of a parent type with objects of a single type, which is a child of the parent? class Foo { int foo; } class Bar extends Foo { int bar; } class Spam extends Foo { int spam; } Bar bara, barb, barc; Spam spama, spamb, spamc; Foo fooa, foob, fooc; [ bara, barb, barc ] @=> Bar bars[]; // okay [ bara, spamb, fooc ] @=> Foo foos[]; // mixed children okay [ bara, barb, barc ] @=> Foo morefoos[]; // incompatible types for assignment? best, Mike -- http://michaelclemow.com http://semiotech.org