Is the following code segment an example of method overloading.
class MyClass { public int Add(int x, int y) { return x + y; } public double Add(int x, int y, int z) { return x + y+ z; } }
Yes.
Is the following code segment an example of method overloading?
class MyClass { public int Add(int x, int y) { return x + y; } public double Add(int x, int y) { return x + y; } }
No.
The compiler will not use "return type" to differentiate the methods.
Return type is not considered a part of a method signature.