Thursday, June 23, 2011

Method Overloading is done only by parameter types, not by return types




{

}


int Meth(int a, int b)return 0;//compile time error //Error 1 Type 'Class1' already defines a member called 'Meth' with the same parameter types //long Meth(int a, int b)//{// return 0;


 //VALID
{

}


//VALID//NOTE : EVEN A RETURN TYPE OF LONG IS ALSO VALID
{

}
int Meth(string b, int a)return 0;
int Meth(int a, string b)return 0;  
//}

No comments:

Post a Comment

 using Microsoft.AspNetCore.Mvc; using System.Xml.Linq; using System.Xml.XPath; //<table class="common-table medium js-table js-stre...