小编Way*_*ose的帖子

D中的抽象自动函数

有没有办法abstract auto在D中有功能?

如果我按如下方式声明一个类:

class MyClass
{
    abstract auto foo();
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

main.d(12): Error: function declaration without return type. (Note that constructors are always named 'this')
main.d(12): Error: no identifier for declarator foo()
Run Code Online (Sandbox Code Playgroud)

我想知道为什么这是不可能的?有没有其他方法可以获得类似的功能?

d

3
推荐指数
1
解决办法
109
查看次数

标签 统计

d ×1