I am trying to understand overloading at the moment and am a bit confused. I understand that when calling the same method, it cannot have the exact same arguments. For instance a method called with 2 int variables and then another with two different int variables. But if I use an int and a float, it would be okay. I know the return type does not matter, but what about it being a public or private method. Would this matter?
For instance, say I call public int name(int x)
would I be able to call private int name(int x)
?
Am I correct in assuming public double name(String x)
would also cause overloading in the class? Also is public int name(int x, String y)
valid? Passing a string argument into an int function? Would this cause overloading or an error?
EDIT: Do not believe this question is duplicate, my main question is the difference between the public and private, are they method or different and would it cause overloading. Did not see that addressed in other question.