You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by temp temp <mi...@yahoo.com> on 2007/03/23 21:30:04 UTC
[JAVA] abstractg class calling abstract method in constructor
I have a super class with an abstract method and a non default constructor and it calls this abstract method in its constructor
This abstract method is implemented in the base class.
First thing base class constructor does is call super()
Example
// super class
public abstract class CustomRuntimeDocument extends AbstractDocument {
public CustomRuntimeDocument(XmlObject aXmlObject, String aFileName ) {
super();
fXmlObject=aXmlObject;
fFilename=getFilePrefix()+aFileName;
}
protected abstract String getFilePrefix();
} // end of class
// base class
public class CustomRuntimeFormDocument extends CustomRuntimeDocument{
public CustomRuntimeFormDocument(Form aForm , String aFileName) {
super(aForm,aFileName);
fForm=aForm;
}
protected String getFilePrefix() {
return "formbuilder_";
}
}
Is this ok or might generate some problems ?
Thanks & Regards
---------------------------------
Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.