Reference

Hi can anyone help

Bigint:: operator+(const Bigint& b) const

what exactly does the above declaration mean? I am confused becasue i thought the & meant pasing as reference parameter but then why pass it as const. Whats the point of passing a parameter as a reference and then making it const so you cant change it?
There's two reasons to pass things by reference. One is to be able to modify the actual parameter. The other is to avoid making unnecessary copies of large objects.
Declaring the formal parameter as a reference to a constant prevents the implementation from accidentally modifying the actual parameter.
I get you. So im pasing the actual parameter but it cannot not be modified. This is useful cos it restricts the unecessary copying of data. Thanks.
Topic archived. No new replies allowed.