Would this work as a copy constructor?

closed account (ETAkoG1T)
assuming the class is not using dynamic memory

1
2
3
4
manager::manager(const manager & m)
{
	*this = m;
}
Last edited on
That depends on your copy assignment operator.
closed account (ETAkoG1T)
I am using the default in this program. I am not using dynamic memory allocation.
It is simpler to write

manager( const manager & ) = default;
closed account (ETAkoG1T)
So does both work? And both do the identical thing? thank you :)
In many cases the copy constructor will be generated automatically so you might not need the line vlad posted.
closed account (ETAkoG1T)
Here is the rest of the program: http://www.cplusplus.com/forum/general/101142/
Topic archived. No new replies allowed.