Cloning (programming): Difference between revisions

Content deleted Content added
Added {{refimprove}} tag to article (TW)
Line 45:
A C++ example of object cloning using pointers (to avoid slicing see <ref>See Q&A at [http://en.allexperts.com/q/C-1040/constructor-virtual.htm en.allexperts.com]</ref>):
<source lang="cpp">
Object * originaloriginalObj = new Object;
Object * copycopyObj = nullptr;
 
copy = new Object(* original); // creates a copy of original and assigns its address to copy