using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ResumeModel
{
class Resume : ICloneable
{
private string name;
private string sex;
private string age;
private string timeArea;
private string company;
public Resume(string name)
{
this.name = name;
}
//设置个人信息
public void SetPerosonalInfo(string sex,string age)
{
this.sex = sex;
this.age = age;
}
//设置个人经历
public void SetWorkExperience(string timeArea,string company)
{
this.timeArea = timeArea;
this.company = company;
}
//显示
public void DisPlay()
{
Console.WriteLine("{0} {1} {2 }",this.name,this.sex,this.age);
Console.WriteLine("工作经历 {0} {1}",this.timeArea, this.company);
}
public object Clone()
{
return (object)this.MemberwiseClone();
}
}
}
客户端
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ResumeModel
{
class Program
{
static void Main(string[] args)
{
Resume a = new Resume("强哥哥");
a.SetPerosonalInfo("男", "28");
a.SetWorkExperience("1997-2000", "X公司");
Resume b = (Resume)a.Clone();
b.SetPerosonalInfo("男", "29");
b.SetWorkExperience("1998-2000", "XX公司");
Resume c = (Resume)a.Clone();
c.SetPerosonalInfo("男", "30");
c.SetWorkExperience("1999-2000", "XXX公司");
a.DisPlay();
b.DisPlay();
c.DisPlay();
Console.ReadKey();
}
}
}