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

How to check local and global angular versions

 Use the command ng version (or ng v ) to find the version of Angular CLI in the current folder. Run it outside of the Angular project, to f...