Hi, I just stumbled about this issue with array of interface. I want to pass several objects (C and D) which shares the same interface A. It seems somehow cumbersome that it only works if there is a cast on the first element of the array.
interface A{}
class B: A{}
class C: B{};
class D: B{};
void main()
{
//A[] arr = [new C(), new D()]; // Does not work
A[] arr = [cast(A) new C(), new D()]; // Does work
}
Is the cast really needed?
Kind regards
André
