Content deleted Content added
Remove a redundant example |
m →Overloading move assignment operator: Improve C++ example |
||
Line 14:
Consider the following move assignment operator for a simple string class:<ref>{{Cite web|title = Move Constructors and Move Assignment Operators (C++)|url = https://msdn.microsoft.com/en-us/library/dd293665.aspx|website = msdn.microsoft.com|access-date = 2016-02-23}}</ref><syntaxhighlight lang="c++">
class String {
public:▼
char* data;▼
String& operator=(String&& other) {
// If we're not trying to move the object into itself...
▲public:
delete
return *this; ▼
}
}
private:
};
</syntaxhighlight>
==References==
<references />
|