Method Overloading with Data type as Object

  • Thread starter Thread starter LordPhyber
  • Start date Start date
L

LordPhyber

Guest
Hey everyone, I am new to C# and trying to figure my way out with method overloading.

I have two methods:

public int multiply(int num1 int num2)
{ return num1* num2; }

public object multiply(object num1 object num2)
{ return 1; }

when I call the method multiply, then which method will be called ? If it is the data type Object, could you please explain why? and how could I change it that it calls the method with data type int? Similarly vice versa.

I appreciate any and all help I can get :)

Continue reading...
 
Back
Top