Why does read define its Sales_data parameter as a plain reference and print define its parameter as a reference to const
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:7| Question number:8
All Answers
total answers (1)
The
`read`
function will change its`Sales_data`
parameter and pass the information back via plain reference.The
`print`
function won't change its`Sales_data`
parameter, and by using a reference to `const`, we can print`const Sales_data`
object as well.