What Does Putting Two Constant Signs On A Function Parameter Do?

55 views Asked by At

I was wondering what two constant signs on a function parameter does in this case?

void virtual_via_pointer( const Employee * const );
2

There are 2 answers

1
geometrian On BEST ANSWER

This isn't specific to function parameters.

const Employee*

Means a "mutable pointer to a constant instance of Employee".

Employee* const

Means a "constant pointer to a mutable instance of Employee".

const Employee* const

Means a "constant pointer to a constant instance of Employee".

See also the Spiral Rule.

0
kiDDevil On

The pointer and the pointee are both constant.