digitalmars.D.bugs - polymorphism via array
- tetsuya <tetsuya_member pathlink.com> Nov 01 2004
- tetsuya <tetsuya_member pathlink.com> Nov 01 2004
dmd 0.105, winXP
cannot use polymorphism via array.
dmd complains..
test.d: function test.foo (Interface []array)
does not match argument types (Class [5])
test.d: cannot implicitly convert expression
classes of type Class [5] to Interface []
to the following code.
<code>
interface Interface {}
class Class : Interface {}
unittest
{
void foo(Interface[] array) {}
Class[5] classes;
foo(classes);
}
</code>
which does work on Java, btw.
tetsuya
Nov 01 2004
oops!! already discussed on http://www.digitalmars.com/d/archives/16345.html sorry for repeating forget it please. In article <cm52ff$11q3$1 digitaldaemon.com>, tetsuya says...dmd 0.105, winXP cannot use polymorphism via array. dmd complains.. test.d: function test.foo (Interface []array) does not match argument types (Class [5]) test.d: cannot implicitly convert expression classes of type Class [5] to Interface [] to the following code. <code> interface Interface {} class Class : Interface {} unittest { void foo(Interface[] array) {} Class[5] classes; foo(classes); } </code> which does work on Java, btw. tetsuya
Nov 01 2004








tetsuya <tetsuya_member pathlink.com>