一佳一

记录像1+1一样简洁的代码

导航

自定义深拷贝

Posted on 2011-02-12 12:21  一佳一  阅读(247)  评论(1编辑  收藏  举报
public CAggregate clone()
{
      CAggregate newObj
= new CAggregate();
     
//newObj.list = this.list;
      newObj.list = new ArrayList();
     
for(int i = 0 ; i < this.list.length ; i++)
      {
          newObj.list[i]
= this.list[i];
      }
     
return newObj;
}