Synopsis: | The copy constructor and the copy assignment operator shall always have a const parameter |
Language: | C++ |
Severity Level: | 5 |
Category: | Class Interface |
Description: |
The main reason for declaring the parameter const is to ensure that the original is not accidentally "damaged" when making the copy. This is a good thing, because it is not expected that the original object is changed when making a copy of it. |
Literature References: |
StackOverflow |