using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClassStudy
{
class Program
{
static void Main(string[] args)
{
Person xiaoMing = new Person();
xiaoMing.Age = 19;
Console.WriteLine(xiaoMing.Age);
Console.ReadKey();
}
}
class Person
{
private int age;
public int Age// 属性
{
set
{
this.age = value;
}
get
{
return this.age;
}
}
}
}
属性,简化get和set
最新推荐文章于 2020-06-04 09:32:49 发布