Programming keyword that specifies that a object or variable is not modifiable
I am having hard time figuring the right keyword, what is the keyword that specifies that a object or variable is not modifiable after it is initialized?
I am having hard time figuring the right keyword, what is the keyword that specifies that a object or variable is not modifiable after it is initialized?
The right keyword is "const". A variable declared as a "const" type can't be modified after it's initialized. If you try to update its value somewhere in your code there will be a compilation error.
If you are having hard time to figure out such keywords, you are most probably novice to C++ programming, so you better check out this tutorial here.
After completing the tutorial you are welcome to ask further questions.
Avila Hoosier
The answer to your question will largely depend on the programming language that you are using. A keyword that specifies that a variable is not modifiable after it is initialized can vary from one language to another. Like if you are using Java, "final" is the keyword used. See sample code below:
It can be used in different circumstances to define an entity which cannot be changed at a later time.