using System;
namespace aMethodwithPar
{
class Person {
public string name;
/// <summary>
/// 设置新爱好
/// </summary>
/// <param name="newHobby">New hobby.(形参)</param>
public string hobby;
public void SetNewHobby(string newHobby) {
Console.WriteLine("我有了新的爱好" + newHobby);
//真正的新爱好:游泳--->实际参数 实参
hobby += "|" + newHobby;
}
}
class Program
{
static void Main(string[] args)
{
Person xiaoming = new Person();
xiaoming.SetNewHobby("游泳");
}
}
}