ActionScript 中的泛型(返回类型与参数类型相同)
是否可以指定函数的返回类型与未知参数类型之一的参数类型相同。例如:
class Factory {
public function get(interface:*):Object {
}
}
上面的问题是我必须一直将对象强制转换为接口。
Is it possible to specify that a return type of a function is the same as one of the parameter types where it is unknown what the parameter type is. For example:
class Factory {
public function get(interface:*):Object {
}
}
The problem with the above is that I have to cast the object to interface all the time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能做到吗?:
似乎不需要转换:
Can you do this?:
Doesn't seem to require casting: