d没有C++的要限定基类的问题.
import core.stdc.stdio;
extern(C++):
//import std.stdio;
class A(int I){
void f(){
printf("%i",I*2);
}
}
interface C(int I){
final void b(){//要有个终.不然不行.
printf("%i",I*5);
}
}
class B(int I):A!I,C!I{
void g(){
f();b();//可以直接调用,不像C++.不行.
printf("%i",I*3);
}
}
void main()
{
scope b=new B!3;//必须有这句,不能放栈上.
b.g();
}
浙公网安备 33010602011771号