I'm having trouble actually inheriting the interface. I keep ending up with the error
error: NameableContainer cannot be inherited with different arguments: < Friend> and <>
I have the following interfaces:
public interface Nameable
public interface Name
public interface Friend extends Nameable
public interface NameableContainer {
void add(Name name, Name prevName);
void remove(Nameable nameable);
T findByName(Name name);
}
public interface FriendContainer extends NameableContainer
I also have an abstract class that inherits NameableContainer.
public abstract class NameableMap implements NameableContainer {
public void add(Name name, Name prevName) { /* do stuff*/ }
public void remove(Nameable nameable) { /* do stuff*/ }
public Nameable findByName(Name name) { /* do stuff*/ }
}
And finally, trying to put these all together
public class Friends extends NameableMap implements FriendContainer
What am I missing?
博客围绕Java中接口继承问题展开,作者在继承接口时遇到错误,给出了多个接口定义,如Nameable、Name、Friend等,还有继承NameableContainer的抽象类NameableMap,最后尝试整合时出现问题,询问缺失的部分。
1223

被折叠的 条评论
为什么被折叠?



