Preson类
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassLibrary1 { class Person { public string _name; public int _age; public char _gender; public void XingWei() { Console.WriteLine("姓名:{0},年龄:{1},性别:{2}", this._name, this._age, this._gender); } } }
class1 类
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassLibrary1 { public class Class1 { static void Main(string[] arr) { Person xinRen = new Person(); xinRen._name = "张飞"; xinRen._age = 19; xinRen._gender = ‘男‘; xinRen.XingWei(); Console.ReadKey(); } } }
时间: 2024-10-26 11:31:24