using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApp1{ public class person { public string name; public int age; public pay personpay; public void setPersonPay(pay varpay) { personpay = varpay; } } public class pay { public int basicSalary;//基本工资 public int commission;//提成 } public class copy { public person deepCopyPerson(person orgPerson) { person result_person = new person(); pay result_pay = new pay(); result_pay.basicSalary = orgPerson.personpay.basicSalary; result_pay.commission = orgPerson.personpay.commission; result_person.age = orgPerson.age; result_person.name = orgPerson.name; result_person.setPersonPay(result_pay); return result_person; } } class Program { static void Main(string[] args) { person Lucy = new person(); Lucy.age = 16; Lucy.name = "lucy"; pay lucy_Pay = new pay(); lucy_Pay.basicSalary = 5000; lucy_Pay.commission = 2500; Lucy.setPersonPay(lucy_Pay); copy copyTest = new copy(); person Lily = new person(); Lily = copyTest.deepCopyPerson(Lucy); Lily.name = " Lily Princess "; pay liliPay = new pay(); liliPay.basicSalary = 4600; liliPay.commission = 2400; Lily.setPersonPay(liliPay); Console.WriteLine("Lucy's name is " + Lucy.name + "!\n"); Console.WriteLine("Lily's name is " + Lily.name + "!\n"); Console.ReadKey(); } }}