I have these class
- Concept
- Link, Relation (which extends Concept)
- Concepts
- Links, Relations (which should extends Concepts)
The class Concepts should have a
private List<? extends Concept> list; //or something similar
addConcept(Concept c); // that should work with a (Link) for the class Links
But this doesn't work the way I tried it... And from searching the Internet, it doesn't look like it can work. How can I make a super class for Links and Relations that include the insertion of a Concept into some sort of memory holder.
This ... doesn't work
public class Concepts{
protected List<? extends Concept> list = null;
Concepts(String text) {
}
public void add(Concept test) {
list.add(test);
}
}
public class Links extends Concepts{
Links() {
list = new List<Link>();
}
public void add(Link test) {
list.add(test);
}
}
.... I want (if possible) to make it impossible to add Relation into Links or Link into Relations