This question is based on an example of JEditorPane and JTextPane, but probably the issues are general to the class heirarchy.
OK it is my understanding that whan class B is a subclass of class A in the java class heirarchy, that means it extends that class, it adds to the functionality. One of the things that means is that from a constructor of class B you can use the super keyword to invoke a constructor of class A, thereby extending the functionality of that class A constructor.
But in the Java Tutorial I came across a comment that casts doubt upon the above. on the following page http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html, we have the following paragraph.
An editor pane or a text pane can easily be loaded with text from a URL using the setPage method. The JEditorPane class also provides constructors that let you initialize an editor pane from a URL. The JTextPane class has no such constructors.
This puzzles me. In light of the fact that extending a class is supposed to expand its functionality, what is the significance of this comment which seems to suggest that in some ways a subclass has less functionality?
This seems too obvious, so no doubt it is late and I am tired and missing something. I guess not all constructors in a higher class can be invoked by super?
OK it is my understanding that whan class B is a subclass of class A in the java class heirarchy, that means it extends that class, it adds to the functionality. One of the things that means is that from a constructor of class B you can use the super keyword to invoke a constructor of class A, thereby extending the functionality of that class A constructor.
But in the Java Tutorial I came across a comment that casts doubt upon the above. on the following page http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html, we have the following paragraph.
An editor pane or a text pane can easily be loaded with text from a URL using the setPage method. The JEditorPane class also provides constructors that let you initialize an editor pane from a URL. The JTextPane class has no such constructors.
This puzzles me. In light of the fact that extending a class is supposed to expand its functionality, what is the significance of this comment which seems to suggest that in some ways a subclass has less functionality?
This seems too obvious, so no doubt it is late and I am tired and missing something. I guess not all constructors in a higher class can be invoked by super?