Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Deepcopy/C-sharp/deepcopy.cs
Normal file
28
Task/Deepcopy/C-sharp/deepcopy.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
|
||||
namespace prog
|
||||
{
|
||||
class MainClass
|
||||
{
|
||||
class MyClass : ICloneable
|
||||
{
|
||||
public MyClass() { f = new int[3]{2,3,5}; c = '1'; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
MyClass cpy = (MyClass) this.MemberwiseClone();
|
||||
cpy.f = (int[]) this.f.Clone();
|
||||
return cpy;
|
||||
}
|
||||
|
||||
public char c;
|
||||
public int[] f;
|
||||
}
|
||||
|
||||
public static void Main( string[] args )
|
||||
{
|
||||
MyClass c1 = new MyClass();
|
||||
MyClass c2 = (MyClass) c1.Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue