What's a 'good' way to initialize an array of references to classes using a
common base?
I've tried this and it works:
class Base
{
void func();
}
class GoodChild : Base
{
void func();
}
class BadChild : Base
{
void func();
}
//...
auto list = [cast(Base)new GoodChild, new BadChild, ...];
I had tried doing it without the initial cast, but ran into issues because D
(DMD v1.033) would infer the type based off of the first element in the
literal, and then assumed that all other elements would be the same.