Question : State whether below overload methods will give compilation erro or not ?

Class Test
{
void SetX(ref int x)
{
x = 1;
}
void SetX(out int x)
{
X = 2;
}
}

Answer :
Gives a compilation error.
SetX method cannot define overloaded methods that differ only on ref and out

No comments:

Popular Posts