Home > Back-end >  A question about the C
A question about the C

Time:10-04

Direct write const on function parameters, such as:
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 complains

CodePudding user response:

Const itself is a constant mean that such parameters cannot be modified after go in

CodePudding 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
  • Related