InterviewSolution
Saved Bookmarks
| 1. |
Explain the impact of access modifier const over variables. Support your answer with examples. |
|
Answer» The access modifier const can be added to the declaration of an object to make that object a constant rather than a variable. Thus, the value of the named constant cannot be altered during the program run whereas the value of the variable can be changed during the program run. Example: void main () { const int a =10; int b = 20; a++; cout<<"a="<<a; b++; cout<<"b="<<b; } |
|