Programming classes

If we define a variable as const double p = 3; and then try to change its value, we will get an error when we compile our program. This means that constant arguments in functions cannot be changed.

// const arguments (in functions) cannot be changed:
void myfunc (const Complex& c)
{ c.re = 0.2; /* ILLEGAL!! compiler error... */  }

If we declare the function and try to change the value to \( 0.2 \), the compiler will complain by sending an error message.