1. Defining constants(1) The const modifier variable, the following two kinds of definition form are essentially the same. It means that the variable value of the type with the Const modifier is immutable.
TYPE const VALUENAME = value;
Const thinking
1. What is const?A common type is a type described by the Type modifier Const. The values of variables or objects of a common type cannot be updated. (Of course, we can steal the bar for updating :)
2. Why is const introduced?The
In the program often encountered the const, but he did not know very well, today saw an article is very good, so copied over ....Original link: http://blog.csdn.net/Eric_Jo/article/details/4138548The use of the Const keyword in C + + is very
C + + In the use of the Const keyword is very flexible, and using the const will greatly improve the robustness of the program, I based on all aspects of the information to summarize the following, I hope to help friends.
Const is a commonly used
The use of the const keyword in C + + is very flexible, and using the const will greatly improve the robustness of the program, I found in various aspects of the information summarized below, hoping to help friends. Const is a type modifier commonly
1. What is const?
A common type is a type described by the Type modifier Const. a variable or object Value of a common type cannot be updated.
. (Of course, we can steal the bar for updating :)
2. Why is const introduced?
The initial purpose
1. What is a const?Const means a constant type, a const-modified variable or object cannot be modified and updated, and of course, in some cases, we can change it rescue.2. Why should I introduce a const?The original purpose was to replace the
1. What is const?
A common type is a type described by the Type modifier Const. The values of variables or objects of a common type cannot be updated. (Of course, we can steal the bar for updating :)
2. Why is const introduced?
The initial purpose
turn from: http://blog.csdn.net/Eric_Jo/article/details/4138548; in C + + The use of the Const keyword is very flexible, and using the const will greatly improve the robustness of the program, I based on the information found in various aspects
The use of the Const keyword in C + + is very flexible, and using the const will greatly improve the robustness of the program, I found in various aspects of the information summarized below, hoping to help friends.Const is a type modifier commonly
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.