Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.4.2
-
None
Description
Instead of
Employee(const Employee &other)
: d (other.d)
{
}
I would recommend using
Employee(const Employee &other) = default;
And I would also add
Employee& operator=(const Employee& other) = default;
...since copy constructor and copy assignment operator should come in pairs.
I agree that the latter isn't strictly necessary for a working QSharedDataPointer example, but people learn from these examples and will use these approaches in their own code.
Whether or not to add defaulted move constructor and move assignment operator is up to debate....according to the rule of 6, it should be added, but it might be confusing.