代码搜索:clone
找到约 4,459 项符合「clone」的源代码
代码结果 4,459
www.eeworm.com/read/169773/5410884
txt 对象克隆.txt
浅拷贝:值字段被会拷贝,引用字段(不)会被拷贝。(shallow copy)
深拷贝:值字段会被拷贝,引用字段会被拷贝。(deep copy)
对用引用的自定义类型:
如果希望实现浅拷贝,继承I<mark>Clone</mark>able接口,并在<mark>Clone</mark>方法中调用Memberwise<mark>Clone</mark>.
引用类型
1.实现浅拷贝
class MyType:I<mark>Clone</mark>able
{
public ...
www.eeworm.com/read/169327/5424645
java custom.java
//$Id: Custom.java,v 1.1.2.1 2003/11/08 02:25:29 oneovthafew Exp $
package org.hibernate.test;
public class Custom implements Cloneable {
long id;
String name;
public Object clone() {
try {
www.eeworm.com/read/167133/5469529
java bitsettest.java
/**
* A test for java.util.BitSet
*
* Written by Edouard Parmelan
*/
import java.util.BitSet;
public class BitSetTest {
private static void show(String name
www.eeworm.com/read/165570/5480971
java demobasiclistuos.java
/* DemoBasicListUos
* ---------------------------------------------
* Copyright (c) 2002 University of Saskatchewan
* All Rights Reserved
* -------------------------------------------- */
www.eeworm.com/read/165570/5481231
java simpledate.java
package Entities;
/** A simple class that represents a date */
public class SimpleDate implements Cloneable
{
public SimpleDate(int nDay, int nMonth, int nYear)
{
day = nDay;
month =
www.eeworm.com/read/165570/5481296
java linkedbasiclistwithrecclone.java
import dslib.list.*;
/** A variation of LinkedBasicListUos with a recursive implementation of listClone(). */
public class LinkedBasicListWithRecClone extends LinkedBasicListUos
{
/** Construc
www.eeworm.com/read/163965/5503711
java clonetest.java
/*
* Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
*
* This software is open source.
* See the bottom of this file for the licence.
*/
package org.dom4j;
import junit.te
www.eeworm.com/read/163959/5504984
java custom.java
//$Id: Custom.java,v 1.1 2004/09/26 05:18:25 oneovthafew Exp $
package org.hibernate.test.legacy;
public class Custom implements Cloneable {
String id;
String name;
public Object clone() {
tr
www.eeworm.com/read/162614/5518652
c covariant4.c
// { dg-do run }
// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Feb 2005
// Origin: bredelin@ucla.edu
// Bug 19891: Incorrect cov