Can’t find the reason why a method does not see inheritance. What am I missing here?
public class Rate extends BaseResource
public class GenericQuote extends BaseResource
public class Payment extends GenericQuote
public void handleMediationErrors(BaseResource response)
handleMediationErrors(myRate) <– works
handleMediationErrors(myPayment) <– fails at compile time tells me that it expects BaseResource not Payment
There’s nothing wrong with the example you’ve given – perhaps you’re using a different
BaseResourcein one of the classes (importing a different one or declaring it separately elsewhere – this can cause confusion!)To prove it, this example compiles perfectly: