digitalmars.D - Interface problem
- Simon Hobbs (28/28) Jul 26 2004 The following program prints "X". I believe it should print "Y", as the
The following program prints "X". I believe it should print "Y", as the import std.stdio; interface X { void doit(); }; class Y : X { void doit() { } }; void writeType(X x) { writefln(x.classinfo.name); } void main(char[][] args) { Y y = new Y; writeType(y); } Hopefully I'm just abusing the undocumented 'classinfo' thing and there is a proper way to do this. Here's hoping... Si P.S. I've worked around this for now by making the interface a class (luckily I can do so in this case)
Jul 26 2004