たとえば、私はこれを持っています:
class A{
private int mine = 0; //Some field...
public A(int a){mine+=a; /*Some operation1...*/}
}
class B extends A{
private int mine = 0; //Some field...
public B(int a){mine-=a; /*Some operation2...*/}
}
そして私は得る:
error: constructor A in class A cannot be applied to given types;
public B(int a){}
required: int
found: no arguments
reason: actual and formal argument lists differ in length
1 errors
エラーがわかりませんか?私に何をするように言っているのですか?
ただし、「A」のコンストラクターに引数がない場合、コードは機能します。
しかし、Operation1 (aka mine+=a;
) を実行する必要があるため、A の引数が必要ですが、失敗します。
私はこの魔法陣に閉じ込められています。何をすればよいでしょうか?