I have a class as shown below.
This class has a method addFilter with 2 parameters (type String and type Command1 )
public class Command1 {
public StringBuffer addFilter(String query, Command1 dataBase) {
//concrete implementation
return query;
}
}
I have another class Command2. Here I need a similar method. The only difference is in the type of parameters passed. (type String and type Command).
public class Command2 {
//TO DO:
public StringBuffer addFilter(String query, Command2 cmd) {
//concrete implementation
return query;
}
}
I have started by using Interface
public interface Helper {
public StringBuffer addFilter(String query, XXXXX parameter2);
}
I would like the classes Command1 and Command2 to implement the interface Helper and override it these two public classes.
However my problem is in dealing with the 2nd parameter. Am I right in my approach? Can anybody tell me how do I handle this issue?