这里使用静态工厂模式的奇怪错误.我错过了什么?这是代码:
class subclass<T> extends immutablestruct<T>{
private immutablestruct f;
private T x;
//constructor
<T> subclass(T y, immutablestruct<T> f ){
this.x = y; //this is there the error is
this.f = f;
}
Run Code Online (Sandbox Code Playgroud)
Nik*_*bak 10
<T>从构造函数声明中删除.现在您要声明第二个通用参数,而您可以访问旧T值:
//constructor
subclass(T y, immutablestruct<T> f ){
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2100 次 |
| 最近记录: |