Java Reference
In-Depth Information
E RROR M SG C LASS : O VERRIDE
public class ErrorMsg extends TextMessage {
...
public void setErrorMsg (String inputMsg) {
...
}
}
P OPUP E RROR M SG C LASS
public class PopupErrorMsg extends ErrorMsg {
public int windowWidth;
public int windowHeight;
}
P RINTFILE E RROR M SG C LASS
public class PrintfileErrorMsg extends ErrorMsg {
public int linesToSkip;
...
public void setErrorMsg (String inputMsg) {
...
}
}
The classes ErrorMsg and PrintfileErrorMsg both define a method called
setErrorMsg , whereas PopupErrorMsg does not define this method. However, a con-
sumer class can call setErrorMsg using any of these three object types.
C ONSUMER C LASS
The Consumer class can now call setErrorMsg , which will exist in all three of these
classes.
Search WWH ::




Custom Search