How to get an instance of two classes implementing an interface
Posted on 2011-09-24
I have an interface, ReportWriter which has two subclasses, csvWriter and XmlWriter which write the report in html and XML formats respectively.
I have sample code below:
public createSuccessfulRow(String msg);
public createFailureRow (String msg);
//Instantiate a class of instance XmlWriter or HtmlWriter based on the Interface
In my class, ReportImpl, I would like to get an instance of the writer from the interface. Can I use a Enumerator?
Please let me know.