Overloading
The next principle of OOP we will discuss is called overloading. Overloading is a powerful concept in OOP that allows us to reuse method names as long as they have different signatures. A method signature is the method name, its parameters, and the order of the parameters:
The preceding is an example of a method that withdraws funds from a given bank name. The method returns a double and accepts a String parameter. The method signature here is the name of the getMyFundsFromBank() method and the String parameter bankName. The signature doesn't include the return type of the method, only the name and the parameters.
With overloading, we are able to define more than one method with the same method names but different parameters. This can be useful in defining methods that do the same thing but take different parameters.
Let's look at an example.
Let's define a class called Sum with three overloaded methods that add the parameters that...