In a class, there can be several methods sharing the same name but differ in
- Parameter types
- Number of parameters
- Order of the parameters declared in the method
By depending on the parameters provided for the method, in the run time, compiler determines which version of the method to execute.
An overloaded method may or may not have different return types. But return type alone is not sufficient for the compiler to determine which method is to be executed at run time.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…