From 31c5da6aa25e71e8f2f99c5f8c957dc8c66c950c Mon Sep 17 00:00:00 2001 From: xliu79 Date: Sat, 18 Jul 2020 17:09:29 +0800 Subject: [PATCH] english --- english/basic_content/const/README.md | 382 ++++++++++++++++++ .../const/class_const/c++11_example/apple.cpp | 15 + .../const/class_const/c++11_example/main | Bin 0 -> 9656 bytes .../const/class_const/c++11_example/main.cpp | 31 ++ .../const/class_const/first_example/apple.cpp | 13 + .../const/class_const/first_example/main.cpp | 32 ++ .../class_const/overload_example/apple.cpp | 13 + .../const/class_const/overload_example/main | Bin 0 -> 9656 bytes .../class_const/overload_example/main.cpp | 32 ++ .../class_const/static_example/apple.cpp | 14 + .../const/class_const/static_example/main | Bin 0 -> 9704 bytes .../const/class_const/static_example/main.cpp | 34 ++ .../basic_content/const/const_function.cpp | 11 + english/basic_content/const/const_num.cpp | 8 + .../const/extern_const/const_file1.cpp | 1 + .../const/extern_const/const_file2.cpp | 11 + .../const/extern_const/file1.cpp | 1 + .../const/extern_const/file2.cpp | 11 + .../funciton_const/condition1/condition1.cpp | 8 + .../funciton_const/condition1/condition2.cpp | 9 + .../funciton_const/condition1/condition3.cpp | 12 + .../funciton_const/condition2/condition1 | Bin 0 -> 9232 bytes .../funciton_const/condition2/condition1.cpp | 10 + .../funciton_const/condition2/condition2.cpp | 8 + .../funciton_const/condition2/condition3 | Bin 0 -> 9232 bytes .../funciton_const/condition2/condition3.cpp | 8 + .../funciton_const/condition3/condition1 | Bin 0 -> 9232 bytes .../funciton_const/condition3/condition1.cpp | 10 + 28 files changed, 674 insertions(+) create mode 100644 english/basic_content/const/README.md create mode 100644 english/basic_content/const/class_const/c++11_example/apple.cpp create mode 100755 english/basic_content/const/class_const/c++11_example/main create mode 100644 english/basic_content/const/class_const/c++11_example/main.cpp create mode 100644 english/basic_content/const/class_const/first_example/apple.cpp create mode 100644 english/basic_content/const/class_const/first_example/main.cpp create mode 100644 english/basic_content/const/class_const/overload_example/apple.cpp create mode 100755 english/basic_content/const/class_const/overload_example/main create mode 100644 english/basic_content/const/class_const/overload_example/main.cpp create mode 100644 english/basic_content/const/class_const/static_example/apple.cpp create mode 100755 english/basic_content/const/class_const/static_example/main create mode 100644 english/basic_content/const/class_const/static_example/main.cpp create mode 100644 english/basic_content/const/const_function.cpp create mode 100644 english/basic_content/const/const_num.cpp create mode 100644 english/basic_content/const/extern_const/const_file1.cpp create mode 100644 english/basic_content/const/extern_const/const_file2.cpp create mode 100644 english/basic_content/const/extern_const/file1.cpp create mode 100644 english/basic_content/const/extern_const/file2.cpp create mode 100644 english/basic_content/const/funciton_const/condition1/condition1.cpp create mode 100644 english/basic_content/const/funciton_const/condition1/condition2.cpp create mode 100644 english/basic_content/const/funciton_const/condition1/condition3.cpp create mode 100755 english/basic_content/const/funciton_const/condition2/condition1 create mode 100644 english/basic_content/const/funciton_const/condition2/condition1.cpp create mode 100644 english/basic_content/const/funciton_const/condition2/condition2.cpp create mode 100755 english/basic_content/const/funciton_const/condition2/condition3 create mode 100644 english/basic_content/const/funciton_const/condition2/condition3.cpp create mode 100755 english/basic_content/const/funciton_const/condition3/condition1 create mode 100644 english/basic_content/const/funciton_const/condition3/condition1.cpp diff --git a/english/basic_content/const/README.md b/english/basic_content/const/README.md new file mode 100644 index 0000000..f324abc --- /dev/null +++ b/english/basic_content/const/README.md @@ -0,0 +1,382 @@ + + + +## 1.The Definition Of const + +Const type is that people use type specifier **const** signiture type to demonstrate,const variables or objects can not be updated。 + +## 2. Effect Of Const + +(1)define variable + +``` +const int a=100; +``` + +(2) check type + +The difference between const variable and define variable: ~~**Constants have types, which can be checked by the compiler; the define macro definition has no data type, it is just a simple string replacement, and cannot be checked for security +**~~ Thanks for point this bug out. +> https://github.com/Light-City/CPlusPlusThings/issues/5 + +Only variables of type integer or enumeration are defined by `const`. In other cases, it is only a 'const' qualified variable and should not be confused with constants. + +(3)prevent modification, protect and increase program robustness + + +``` +void f(const int i){ + i++; //error! +} +``` +(4)Save space and avoid unnecessary memory allocation + +From the compile point of view, the variables can be defined by const only give the corresponding memory address. Meanwhile the #define gives an immediate number. + +## 3.const object is the file local variable by default + + +

Attention:not const will be set as extern by default.For the const variable to be accessible in other files, it must be explicitly specified as extern in the file + +

+> Access of variables not modified by const in different files + + +``` +// file1.cpp +int ext +// file2.cpp +#include +/** + * by 光城 + * compile: g++ -o file file2.cpp file1.cpp + * execute: ./file + */ +extern int ext; +int main(){ + std::cout<<(ext+10)< +using namespace std; +int main(){ + + int num=0; + int * const ptr=# //const指针必须初始化!且const指针的值不能修改 + int * t = # + *t = 1; + cout<<*ptr< +using namespace std; +int main(){ + const int num=0; + int * const ptr=# //error! const int* -> int* + cout<<*ptr< +#include"apple.cpp" +using namespace std; + +Apple::Apple(int i):apple_number(i) +{ + +} +int Apple::add(int num){ + take(num); +} +int Apple::add(int num) const{ + take(num); +} +void Apple::take(int num) const +{ + cout<<"take func "<aSVeq)AF6Y0^vHAaKLM z3Y;0@nA>@rx81l+H{G4e+~%COD@8nzKX#|L;qdfs-6q;9I-HE_rqX@B&-;9nH*XW? zdE1xE`+dGYpYQX1e!TDVE#C~ZuCv>0g266s5kxs_eUfE7g&4a=l8V%ywUc9mV;1!KoD6RezQ8Qmf);tcEL=CllTE zb<2~nWywS;w|&|6hWcgob?$81y+V$g{FCnbjh(V5&Z7$y#XJW;N;S!c*Z%AqFE;$) zY~!2to1e+&{&oEiUauzEbo_YUup))cW<*VVn#OBCy*On_;7se>!_%8UmW3POV0IY^ zd2*HEFRZ}-J^1DP+*QGUYX$zw3jWVk@V}{o{+bH@_f+unu;O2s>_e*v2{dV3M=kto z;D45wFLpb_QrQVw0_Hud$D%jgL~~s)G;K>?I;CaxNJiH*q20PoYmaY9Wc7HaDH+LT z<5{7#gf?igct){98=8{oR6G>vPR0#cdCA=yJM@M`I;(X@vhli>R6=j|2DS+e{B$xK zXj|9bk?zm}V07qp@l-6?67A5v-e_+mqv@GQLeI8D1A%t%R>DIfs-?4fCLZZ)327mZ z7U-x)v=jSiGWzJyli8N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a402i z%&l z4<+CQWwz)0oUR-$D$%BIy;5ifc?oxJ?*FjeClwAW2H)drB)3?XP^8$1#x(rcp6`b* zD~7D-Lr!%H8hb5%1o(oKa66uOwH5679_dkmavj6aE`CQdy%`OvA#neE-yBo{e_1JV z{H(`#E96v@V4Clx!^)sd*;D+a!|^M&pnC*`%JzJJ^{B#3rTp>u_bU5Fu~)4Oor9?d3|&LJg&o*{<+>U zMuP&dzCjgf=Kmc6bNq$6i0UBBh6=MC<1vdp-&@1Vp5tUUY{&FvG>FIJ->vRT{mO8j z8b9m1xS? +#include"apple.cpp" +using namespace std; +Apple::Apple(int i) +{ + +} +int Apple::add(int num){ + take(num); +} +int Apple::add(int num) const{ + take(num); +} +void Apple::take(int num) const +{ + cout<<"take func "< +#include"apple.cpp" +using namespace std; + +Apple::Apple(int i):apple_number(i) +{ + +} +int Apple::add(int num){ + take(num); +} +int Apple::add(int num) const{ + take(num); +} +void Apple::take(int num) const +{ + cout<<"take func "<hdOo2wCZSQY_SiA>DUm81?}{qGu3L#bf^PNqG(Ymld(wp{pX&4bN6Of zop#!v+54aW`yc0h?md6_MzDFM)8PRNpxHRng>+&M-yhLU<%V ze$>`cr5~NqDRJgoR6F)l!z6j+lVI|j>yjdPrz|i(p&G`V`$v7FU%QIi?({<<*-uO~ z$>%sHTcVazMpXJuGv)Saepz6iFk!)*{ceRHwez!*TN$>h`bv#UrD{KO)m?EzBHmS3 zdqW~xorov1TdKFz*HzcmdNV2S64`HxPqwSpcF3A|96gYz&9m{Np(g$6H?K^)ZhP*o z>3@0f@sq1h-RLTN?*i$j zS=ri_YSV)N+Kk#*GMWfQ+Kif-NKZJe8|iS|$b=%nU@Neth!BtHsf>}1g?mHodb>{# zw$-7v6YFR+>u56)nb2no7imYZWqQjk5wj_gRMyD1GA=M)5gsaxQe=}J>Di=rhvNy1 zU1UpG4;!&9ad_xtsRpt)98Zc>&7p=yeTla=Us~c_W|r@`LthFUWNuF<_7d$FlFIQk z|B>E-at-E=*1HeC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x|L;@&4Ju&gB)=?mD*rbWPR$`7uAluM1V-bk%=7o* zdRi19&M%qL#QD!bVfE*GbEop(&yI?_ZTwNlR)4|wDb-MJFNd+qkK6qDJKn7fucF0a zA+DdHAEIEbpYQ9nv?xJSOqPGDWtEqoL5ci%{`mXZulz5`Tbc#C|8q8fzDKny|HP;G zAF}y#o?uA%|A`uBA^Z5f3>|&@@-XrJi~k>keZ1`cufcbw#h>#ImFk1qZf}?W4qs{_ z*U$HR_hbN$?}eYW~J-!V#^0j< zK_@#Z&VI~CZT@_p?Nt8UP7cF +#include"apple.cpp" +using namespace std; +const int Apple::apple_number=10; +Apple::Apple(int i) +{ + +} +int Apple::add(int num){ + take(num); +} +int Apple::add(int num) const{ + take(num); +} +void Apple::take(int num) const +{ + cout<<"take func "<K$*`{=mSxgl^u}EAa zs(@7D=aUkmW{v5Xa?P|_>6L?4;MZJc0?lPUSz&sO38MwGa1V)6dlSW{swRDArpYoD z!Yu)^qrQ$Q`Pj^m#F^fw`f-RlCW~7>2`0OFPRW9XWQFOl>KIcVAB~NEUCM7)nGYQC zJ|dz`J|`&YQt3EnM5%5}mn^7HR+uJCSTJR~FTsxb`EiR&DQ-~hm5NKX>OWI8Tybk6 z-qX}@Ya&{gh$pk#>$W#H)ipJEGAYkeId1Y#x~tc9%a%BfZgAA+IrveiN&e%P@2lRl z`SSLf&fneOdf?cbXAb>y9m!_k$Mc32DI5;7*M!qFe)@xpQ)>gSwa+~`qZMq?aw8nf zE+QdM?jrc268KBNi}|^$g#Y#u__7lI&z11MzJ&gY68?9W@N+=n7pC}7n<#NqXrAftLmIo-v}4TW+DbZW6k_xj&WEGe$UV=(^C?Y|}TyHpeqYEZv$2 zXEL#j(1TrT^=K@u;I6f;iBvMy74AvIOj&Ws-RnAy=6EWj_k=UChF~&owABZ;2_1MU zkqLCH+R&Nm)B^xIjfPk2Tc01S5gK24KtJAs*3F86zDF_XoT5 zF0UTwY(j4*x6x|0(P<hYC@OY|$fqTlC&= zJb~Cn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jHCNI0_4F=3lGk}ew=CYy!~$<^gWALQ2x7x?`iz^U%vlyJEUtZ^!}kc zH(uMa@O_T|zUo#u6TB`8NUBb<#2Iy$G0pY@n-ft+#}%=7(qSQ&IEd+I;waQ_u7=)OT+WqZEodQ~E) zRQ!1S4=Vc>%H$@`e+~kxJ>RcG z%Ki`=D(bS)Z-ckm3%+-$j>5jh+9l&7QyaT}rWq7Kf#9`waa66>Ix^ukWHoi89qB z`KMY|dHzSJkv-2Je`kl3{Z)BQvtqaZxy_#MTm1hV5+7lI)Mn55gkjbG@2PW^VvpZx z$mm;`!^HPA{(lelc-ie=gY7JfJ?AH?)d#j+-_HLTw$w##pYs5&k7@rFY-#PXJ?HKC z|D_D8@$>rT_IX?fZS8YjWQ+!d!ulpR!886h2(10j--}fPAvRQ$?U;_)?D^gsQucF7 z*fV?u74pU7-=*$JhO(ch#?Sh0t|(d#IjMMUINLYcaCXPE26ArOsygpllbgYcN@!zc l+q`$I_J>vfYgM4=9A1VW$BoY~+MmVRKcf_Uwhd=*|399R>MH;M literal 0 HcmV?d00001 diff --git a/english/basic_content/const/class_const/static_example/main.cpp b/english/basic_content/const/class_const/static_example/main.cpp new file mode 100644 index 0000000..74ca4f0 --- /dev/null +++ b/english/basic_content/const/class_const/static_example/main.cpp @@ -0,0 +1,34 @@ +#include +#include"apple.cpp" +using namespace std; +const int Apple::apple_number=10; +int Apple::ap=666; +Apple::Apple(int i) +{ + +} +int Apple::add(int num){ + take(num); +} +int Apple::add(int num) const{ + take(num); +} +void Apple::take(int num) const +{ + cout<<"take func "< +using namespace std; + +void f(const int i){ + i=10; // error: assignment of read-only parameter ‘i’ + cout< +using namespace std; +int main(){ + const int b = 10; + b = 0; //error + const string s = "helloworld"; + const int i,j=0; +} diff --git a/english/basic_content/const/extern_const/const_file1.cpp b/english/basic_content/const/extern_const/const_file1.cpp new file mode 100644 index 0000000..7077ac9 --- /dev/null +++ b/english/basic_content/const/extern_const/const_file1.cpp @@ -0,0 +1 @@ +extern const int ext=12; diff --git a/english/basic_content/const/extern_const/const_file2.cpp b/english/basic_content/const/extern_const/const_file2.cpp new file mode 100644 index 0000000..53729f4 --- /dev/null +++ b/english/basic_content/const/extern_const/const_file2.cpp @@ -0,0 +1,11 @@ +#include +/** + * by 光城 + * compile: g++ -o file const_file2.cpp const_file1.cpp + * execute: ./file + */ +extern const int ext; +int main(){ + + std::cout< +/** + * by 光城 + * compile: g++ -o file file2.cpp file1.cpp + * execute: ./file + */ +extern int ext; +int main(){ + + std::cout<<(ext+10)< +using namespace std; + + +int main(){ + const int *ptr; + *ptr=10; //error +} diff --git a/english/basic_content/const/funciton_const/condition1/condition2.cpp b/english/basic_content/const/funciton_const/condition1/condition2.cpp new file mode 100644 index 0000000..9db7339 --- /dev/null +++ b/english/basic_content/const/funciton_const/condition1/condition2.cpp @@ -0,0 +1,9 @@ +#include +using namespace std; + + +int main(){ + const int p = 10; + const void *vp = &p; + void *vp = &p; //error +} diff --git a/english/basic_content/const/funciton_const/condition1/condition3.cpp b/english/basic_content/const/funciton_const/condition1/condition3.cpp new file mode 100644 index 0000000..5809e5f --- /dev/null +++ b/english/basic_content/const/funciton_const/condition1/condition3.cpp @@ -0,0 +1,12 @@ +#include +using namespace std; + +int main(){ + const int *ptr; + int val = 3; + ptr = &val; //ok + int *ptr1 = &val; + *ptr1=4; + cout<<*ptr<W)*@Dm zpx7$5h*dx;@e4`~ajV39QH5q+t?WGD75KHdEuh66lm+Ho9dm9WajLIKK~=PP=UPi- zE`(nKS`&12W5fzN`7B~AGPz7l1~|StNK~UY|5lxnuRmTAJ&dn*!N%V5jUi#V6Z6`}<@~JdS=y)W2H%XsAj5lDGM}!>70W zy61)8od3tRHQ#;m#pgdF9lc6^Z$kKl%Vo8i@OAjzeD%ZCJHoGZZk$@z2C*!?2XsRj z4Mp;o!MCn}{}y<;I5(q#B44W4GN#@3dLy`tWEvrDx4(#?*D8?>(w_Cx(rznaH#yquFdC zEA&Y3K0ThuD7bfDTQZ$W^hO7h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^cDUSO_LDyD0{XoVqu3ye) z{ZiQvIP5O~r*Wq1HBmx7h4>wCAM#?(_^(TQWn^OqF>Yi(rPc+juB~9d1qTqC56(PY z960sYS+85Z7q6iEKT$?Lg_xD`%X}AN88d6!Oe`tN4R99kRTrufmGT|1VXKmdNVq#q~TO9Fqkv& z7Zf8d0wj$@vm+u9Kb}H7i<=osb2O33V%nDoI&_&tGD;4rG?p|)Kn_#@#lUbHBC^$Z z(kg{fS~fV47*XqTB#s~~S+3RswLG}|^%%@hO?1?Vp$%!1!ULh+2k=Hj09(ZWnDbKv3wW>x|?$Se4k0F2J`rH``M295%|+xmu0^9Oe%*i zRS~tHY`Faj7IaRfrm{cZk1i?ymBx?z|FH6JRRQ_F?o$ba8HH0g^5Oc~|8Zb6uFAY{ z-KmI!V38zKKJwA$DQNl^nVS$>uvsgudSw_Ag8@k z{xfW-iL{1^`2Oqrg#K^Aho&0)bAE^a|H38Je>EKo?csh+!Pj0t-=`O;Qy^!1S!Vto zZ0!Dpd$+3Kkc?7%upje9hdyv`wWB*0G^dIz(AF&wac9v#R|qY8~GM +using namespace std; +int main(){ + + int num=0; + int * const ptr=# //const指针必须初始化!且const指针的值不能修改 + int * t = # + *t = 1; + cout<<*ptr< +using namespace std; +int main(){ + + const int num=0; + int * const ptr=# //error! const int* -> int* + cout<<*ptr<0HwjQD(Fp-R%EYE*>sZFd6wuc2yyu?R zxxR5=0`UWBZ{_=*_jy0g$35rVbKdl8;qETC%O#lH;x0kbbY)ON)>DX{o200)HnC0w z#Wr!1r~p!qUr=g@TP5a8Dm3#dW#<7e!>`S40d4M}EHLNlm~#t>Q++EGR7Hz_c7r7{ z7s4+A@}sscT_;8GAz5HPq1y2zHB6FUJ_#njITO z$w6YGQ$ANX*%I}xnm8-+FBc0TLRg1V7Kfy#V6an2L@zKJdS=y)W2H%XsAj5<*uDi9KGYI z`dzh8yDnG%=FOLCXVRpjSIO^92%m7dtX31g5x<+?e`j5N_;UB=nT;I~OVXP_Hcy3(329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lfUFPI;y{k90KdgrjbW+w*4g{Bxde+05GSE7E z3jq#xb@hdjJq)#Xhsmj^-SJ{TCPana`Go_a{gIB9JYp~?(}61Sr;>%SY)+0BLj3z| zYU!M1$+%WlmO8A|$U;)?(Vnn$XjVt3tg9pXzf9;J#H)!LDLt1>U`)ugbbeQlN6n~} zCq;vh73P;g`CLlAIx5xU*|a`}7ffkmE6GaZW=#owIGZiRDo)R?bP!Y3kvw)(@gHZB z9dQ!WH6a4oe22e?c+gB0$nu zG&?2&@#87Pv$&bDG)EJeET(;tphK5QB%|b@N)t&_1mr*kPz;QwAtGCiC#_N#rDcNy zi7~Y<$KnXWlI3bGP|JhMUy8vD)kMdQ7}}6FDLfGBeE@Gn1h7?%WBIF1>Azrf4#HMf z_zv>Mw46}@-w(?rx^mxDqBwv8-CfzA?;p=AphtC>?!Q#zdnZmbk`CdCPe{R^ z?I$-A%cEzR#pogL(Y9{cOkl2>j`;%QD}4rj3t_aLsO0YIlsgIf8mPiznYGP_He&u;A^j+@6$`vDUh?hEHi%-Hg^BQy<1gq zSVmcSupjd!hdyv_qv1HnO2oIz(AF&wac9ldAn~Y8`(J%H8;J|9StSWmc;G->C%V5r@)Q G|33i^HI)Pa literal 0 HcmV?d00001 diff --git a/english/basic_content/const/funciton_const/condition2/condition3.cpp b/english/basic_content/const/funciton_const/condition2/condition3.cpp new file mode 100644 index 0000000..aed864c --- /dev/null +++ b/english/basic_content/const/funciton_const/condition2/condition3.cpp @@ -0,0 +1,8 @@ +#include +using namespace std; +int main(){ + + const int num=10; + const int * const ptr=# //error! const int* -> int* + cout<<*ptr<C%z4WA#Q0*+#siO+&^Qvy(WzuF^K-qZGF6#<88`Qpb+$ z>#nUBWXe`yb=|`FP^1Bx_>%ZB7*c->el#ha+D!tfLlhz4N151^Y#qy3nF87xp7-4I zI@dQgOdx(B?X7&@^FHs#`MBqtd(NAFIo#9jcDV$TTYOrOG*cCnko6Rz_a-SStX-@Z zL9tETB-R0`#4ji{#H|wZWfhu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{Ob;XzQ0Y;qy%w$EorU%Z7A&Z&r}7a>5THfl?PS@ z;ChuPzK4R{pYMaGRYHUF8f@?E|BsYEpLO}1H?JI>_AE31sq*J$^7)pIwb#%0>1FB^$k|?&nZF4eyMN){ zttvPqqpUvIkNL90pYP{~ls~tVBd{OK*H9pg`#+`5`{T;7LG_>Q{ajF-{@zX|%?_OX zcRO$n$Gi@DuG?m8$=DDuH>} Ip>)>&Pq=@S(EtDd literal 0 HcmV?d00001 diff --git a/english/basic_content/const/funciton_const/condition3/condition1.cpp b/english/basic_content/const/funciton_const/condition3/condition1.cpp new file mode 100644 index 0000000..b58bca7 --- /dev/null +++ b/english/basic_content/const/funciton_const/condition3/condition1.cpp @@ -0,0 +1,10 @@ +#include +using namespace std; + +int main(){ + + const int p = 3; + const int * const ptr = &p; + cout<<*ptr<