Content deleted Content added
HeyElliott (talk | contribs) Clean up/copyedit |
HeyElliott (talk | contribs) |
||
Line 43:
</syntaxhighlight>
C++ objects in general behave like primitive types, so to copy a C++ object one could use the '<code>=</code>' (assignment) operator. There is a default assignment operator provided for all classes, but its effect may be altered through the use of [[operator overloading]]. There are dangers when using this technique (see [[Object slicing|slicing]]). A method of avoiding slicing can be implementing a similar solution to the Java <code>clone()</code> method for the classes and using pointers. (
A C++ example of object cloning:
|