- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Person
- {
- class MyClass
- {
- private string _name;
- public string Name
- {
- get { return _name; }
- set { _name = value; }
- }
- public MyClass(string name)
- {
- this._name = name;
- }
- public void Show()
- {
- Console.WriteLine("姓名是:{0}", Name);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- MyClass m1 = new MyClass("张三");
- m1.Show();
- MyClass m2 = new MyClass("李四");
- m2.Show();
- Console.ReadKey();
- }
- }
- }
复制代码 |