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();

}
posted @ 2022-03-08 10:12  zjh6  阅读(13)  评论(0)    收藏  举报  来源