When should reference parameters be references to const? What happens if we make a parameter a plain reference when it could be a reference to const
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:6| Question number:20
All Answers
total answers (1)
If the reference parameters will not be changed inside function, then they should be reference to `const`.
If we make a parameter a plain reference, then we can not pass
- a
`const`
object,- or a literal,
- or an object that requires conversion to a plain reference parameter.