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.