做个题目,做对的有奖
class Program
{
private string str = "str ";
private int i = 0;
static void ConvertString(string str)
{
str = "str has convert ";
}
static void ConvertString(ref string str)
{
str = "str has convert ";
}
static void ConvertString(Program c)
{
c.str = "str has convert ";
}
static void Add(int i)
{
i++;
}
static void Add(Program c)
{
c.i++;
}
static void Main(string[] args)
{
string str = "strTmp ";
int i = 20;
Program c = new Program();
Add(i);
Add(c);
Console.WriteLine(i);
Console.WriteLine(c.i);
ConvertString(str);
Console.WriteLine(str);
ConvertString(ref str);