I am trying to implement a callback procedure by having a class implement and interface, and then pass that class as an object (of the interface) to another class. However, I am receiving the error: "The constructor ClassB(TestMe) is undefined". I thought that I was doing this correctly, I don't know what I am doing wrong. Can someone please offer some advice? My code is below:
I have an interface:
public interface RequestResults {
public void requestFailed(String message);
public void requestSucceeded(String xml);
}
And I have a class that implements the interface:
public class TestMe implements RequestResults {
public TestMe() {
ClassB b = new ClassB(this);
}
public void requestFailed(String message) {
// TODO Auto-generated method stub
}
public void requestSucceeded(String xml) {
// TODO Auto-generated method stub
}
}
Finally, I have a class that is instantiated in the prior class:
public class ClassB {
RequestResults results;
public ClassB(RequestResults results) {
this.results = results;
}
}
Thanks!
I've coded the whole thing on my side and everything compiled. Cleaning and compiling it afresh might help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With