Content deleted Content added
FatalError (talk | contribs) m disambig |
corrected c++ example + added reference |
||
Line 42:
</source>
A C++ example of object cloning using pointers (avoids slicing)<ref>See Q&A at [http://en.allexperts.com/q/C-1040/constructor-virtual.htm en.allexperts.com]</ref>:
<source lang="cpp">
Object * original = new Object;
Object * copy = NULL;
copy = new Object(* original); // creates a copy of original and assigns its address to copy
</source>
==References==
{{reflist}}
[[Category:Object-oriented programming]]
|