mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 10:53:14 +01:00
32 lines
391 B
D
32 lines
391 B
D
interface Inter
|
|
{
|
|
int func();
|
|
}
|
|
|
|
extern(C) int printf(char*, ...);
|
|
|
|
class InterClass : Inter
|
|
{
|
|
int func()
|
|
{
|
|
return printf("InterClass.func()\n");
|
|
}
|
|
}
|
|
|
|
alias int delegate() dg_t;
|
|
|
|
void main()
|
|
{
|
|
scope c = new InterClass;
|
|
|
|
{
|
|
Inter i = cast(Inter)c;
|
|
{
|
|
dg_t dg = &i.func;
|
|
{
|
|
int j = dg();
|
|
}
|
|
}
|
|
}
|
|
}
|