(this MyType) and interface: Symbol undefined
andre via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 8 06:00:55 PDT 2014
Hi,
please consider following example. I want to acces class B by
interface I.
Method "work" should print the actual class ("B").
The linker say:
Error 42: Symbol Undefined _D3app1I17__T4workTC3app1IZ4workMFZv
Is this is missing feature or even a bug?
Is there any other way to get the actual class ("B") printed
by the inherited method from A?
Kind regards
André
interface I
{
void work(this MyType)();
}
class A : I
{
void work(this MyType)()
{
import std.stdio;
writeln(MyType.stringof);
}
}
class B : A {}
void main()
{
I i = new B();
i.work(); // Expected output: "B"
}
More information about the Digitalmars-d-learn
mailing list