I have the following code in c#
class Sample{
public void sum(out int num1,int num2)
{
}
public void print()
{ int i=12;
sum(out i,10);
Console.WriteLine(i);
}
}
I have read that it works like 'ref',then why the following code give error saying "the out parameter 'num1' must be assigned before control leaves the current method",even i am not writing any statement there or not using num1 and i already assign it the value in callee method?
if i am not using or initialise out parameter,then why it is not initialized to its default value,for here num1=0,and return that value to calee method?