ジェネリックを使用して、インターフェイスを実装するオブジェクトを受け入れようとしていClient
ますが、うまくいかないようです。
public interface Client {
public void makeMove();
}
public MyClient implements Client {
public MyClient(Server server) {
server.connectClient(this);
}
}
上記のエラーは次のとおりです。The method connectClient(Class<? extends FanoronaClient>) in the type Server is not applicable for the arguments (GUIClient)
ジェネリックを持つサーバー:
public class Server {
private Class<? extends Client> client_;
public void connectClient(Class<? extends Client> client) {
client_ = client;
client_.makeMove(); // type error here
}
}
そして、ここでのエラーはThe method makeMove() is undefined for the type Class<capture#7-of ? extends Client>
私は何を間違っていますか?