Void swap (const int & amp; A, int & amp; B) const here will play the role of a what kind?
CodePudding user response:
& A value, in the function body cannot be modified, amended, the compiler complainsCodePudding user response:
Const itself is a constant mean that such parameters cannot be modified after go inCodePudding user response:
Guarantee you the data after reference to the function, function not to modify the data, because the data is Shared with other functions, so to ensure the security of data