"reference to getParam is ambiguous, both method getParam(int) in Base and method getParam(long) in Sub match"
How does the compiler select among overloaded methods?
The exact manner in which the system determines which method to invoke in each particular case is also very involved. Basically, the system determines which of the overloaded methods to execute by matching the types of parameters passed to the method to the types of arguments defined in the formal argument list.
sub.getParam(l); //Should call getParam from Sub
sub.getParam1(i); //Should call getParam1 from Sub
sub.getParam1(l); //Should call getParam1 from Base
sub.getParam(i); //Should call getParam from Base