是否有像参数化类型那样的抽象类型清单?
我想知道你是否可以在 Scala 中编写如下内容:
abstract class Foo
trait Bar {
type Foo_Tpe <: Foo : Manifest[Foo_Tpe]
def fooClass = classOf[Foo_Tpe]
}
I wonder if you could write something like the following in Scala:
abstract class Foo
trait Bar {
type Foo_Tpe <: Foo : Manifest[Foo_Tpe]
def fooClass = classOf[Foo_Tpe]
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,也不是。您可以这样做:
此时它会告诉您它没有相应的清单。
Yes and no. You can do this:
At which point it will tell you it doesn't have a manifest for that.
不,但你可以要求子类提供它:
No, but you can ask a subclass to provide it: