add copy assigment overload

This commit is contained in:
Mylloon 2023-10-10 18:14:28 +02:00
parent a6265a4442
commit 7a7b89ae67
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 8 additions and 4 deletions

View file

@ -4,9 +4,11 @@
#include <iostream> #include <iostream>
struct Example { struct Example {
Example(); // constructor Example(); // constructor
Example(const Example &); // copy constructor virtual ~Example(); // destructor
virtual ~Example(); // destructor
Example(const Example &); // copy constructor
Example &operator=(const Example &); // copy assignement
}; };
#endif #endif

View file

@ -2,6 +2,8 @@
Example::Example() { std::cout << "Hello, world!\n"; } Example::Example() { std::cout << "Hello, world!\n"; }
Example::~Example() {}
Example::Example(const Example &) {} Example::Example(const Example &) {}
Example::~Example() {} Example &Example::operator=(const Example &src) { return *this; }