using System;
public class A{
private int a, b, c;
private int r;
public A(){
a = 1; b = 2; c = 3;
}
public void DoAdd(int v1, int v2, int v3, out int v){
v = v1 + v2 + v3;
}
public override string ToString(){
return String.Format("{0} {1} {2}. {3}", a, b, c, r);
}
public void Go(){
Console.WriteLine("{0}", this);
DoAdd(a, b, c, out r);
Console.WriteLine("{0}", this);
}
public static void Main(){
new A().Go();
}
} | |
v is an out parameter. It is used as
an alternative to return v1 + v2 + v3.
The keyword out is also used on the actual parameter!
|