2005年06月06日 星期一 17:27
public const List void getStaffList() { ~~~~~??????? return staffList > 上次面试的时候一个老外问的,我说在getStaffList()中对于staffList做个 > protected-copy,他没反应。 > 大家帮着想一想!谢谢啊! > > pilbic class Company { > private List staffList; > > public List void getStaffList() { > return staffList; > } > > ..... > } > > public class EvilAgency() { > > public void buildContact() { > > List stafflist = myCompany.getStaffList(); > ..... > stafflist.clear(); //how to prevent this occuring? > ..... > } > ...... > } > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050606/b353346f/attachment.htm
Zeuux © 2025
京ICP备05028076号