d的betterC`有一个`,来替换`是一个`的继承
使外(c++)在-betterC中有效地址
struct Base
{
int x;
void g(){
import core.stdc.stdio;
printf("%d",x);
}
}
struct Derived
{//有一个来实现继承
Base _base;
alias _base this;
}
void foo(Base b)
{
b.g();
}
extern(C)void main(){//Symbol Undefined __d_run_main
//没有extern(C)就会出现上面的问题
Derived d;
d.x = 42;
foo(d);
}
浙公网安备 33010602011771号