better copy assignement default
This commit is contained in:
parent
f3ca4dd8fa
commit
387511e750
2 changed files with 9 additions and 3 deletions
|
@ -8,7 +8,7 @@ struct Example {
|
||||||
virtual ~Example(); // destructor
|
virtual ~Example(); // destructor
|
||||||
|
|
||||||
Example(const Example &); // copy constructor
|
Example(const Example &); // copy constructor
|
||||||
Example &operator=(const Example &); // copy assignement
|
const Example &operator=(const Example &); // copy assignement
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,4 +6,10 @@ Example::~Example() {}
|
||||||
|
|
||||||
Example::Example(const Example &) {}
|
Example::Example(const Example &) {}
|
||||||
|
|
||||||
Example &Example::operator=(const Example &src) { return *this; }
|
const Example &Example::operator=(const Example &src) {
|
||||||
|
if (this == &src) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue