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1>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|wZWfhuvwX*YoSK!y~wt#kbP!^bTbo|_^>Q6pH%I5ni?j_FP{XHUxQbQ;KQ=O{IY5obM7DYjeY|v?tnW8
ziR2(L(Iua&oNS4DUoqoUetx|a!Gp5Eyqw=>;79FzzvNSfeX724<5I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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<
Date: Sat, 18 Jul 2020 19:32:55 +0800
Subject: [PATCH 20/62] english
---
english/basic_content/enum/README.md | 161 ++++++++++++++++++
english/basic_content/enum/classic_practice | Bin 0 -> 9328 bytes
.../basic_content/enum/classic_practice.cpp | 87 ++++++++++
.../basic_content/enum/tradition_color.cpp | 10 ++
4 files changed, 258 insertions(+)
create mode 100644 english/basic_content/enum/README.md
create mode 100755 english/basic_content/enum/classic_practice
create mode 100644 english/basic_content/enum/classic_practice.cpp
create mode 100644 english/basic_content/enum/tradition_color.cpp
diff --git a/english/basic_content/enum/README.md b/english/basic_content/enum/README.md
new file mode 100644
index 0000000..9d91a7d
--- /dev/null
+++ b/english/basic_content/enum/README.md
@@ -0,0 +1,161 @@
+# From beginner to Master
+
+## About author:
+
+
+
+
+
+## Traditional
+
+
+Enum has the following problems:
+
+- The scope is not limited, and it is easy to cause naming conflicts. For example:
+
+```c++
+#include
+using namespace std;
+
+enum Color {RED,BLUE};
+enum Feeling {EXCITED,BLUE};
+
+int main()
+{
+ return 0;
+}
+```
+- Implicit conversion to int
+
+- The actual type used to represent an enumerated variable cannot be explicitly specified, Therefore, forward declaration of enumeration types cannot be supported.
+Implementation:[tradition_color.cpp](tradition_color.cpp)
+
+## Classic Method
+
+A simple way to solve the problem of naming conflicts caused by unlimited scope is to prefix the enumeration variables. Change the above example to COLOR_BLUE and FEELING_BLUE。
+
+Generally speaking, we usually prefix all constants for uniformity.But the code for defining enumeration variables is cumbersome.This may have to be done in the C program. But C++ coder do not like this method。Alternatives is namespace:
+```c++
+namespace Color
+{
+ enum Type
+ {
+ RED=15,
+ YELLOW,
+ BLUE
+ };
+};
+```
+
+Then you can use `Color::Type c = Color::RED;` to define the new enumeration。If after`using namespace Color` ,the prefix can also be omitted to simplify the code.However, the scope closure provided by a namespace is not high because it can be subsequently extended.In large projects, it is still possible for different people to give different things the same enumeration type names.
+
+A more "effective" approach is to limit its scope with a class or struct.For example:The new variable is defined in the same way as in the namespace above. This way, you don't have to worry about the class being modified elsewhere.We use structs instead of classes because we want these constants to be publicly accessible.
+
+```c++
+struct Color1
+{
+ enum Type
+ {
+ RED=102,
+ YELLOW,
+ BLUE
+ };
+};
+```
+
+Implementation:[classic_practice.cpp](classic_practice.cpp)
+
+## C++11 Enum class
+
+The above approach solves the first problem, but it can not do anything for the latter two.Fortunately,C ++ 11 standard introduces enum class. It can solve the above problems.
+
+- The scope of the new enum is no longer global
+
+- Cannot be implicitly converted to another type
+
+
+```c++
+/**
+ * @brief C++11 enum class
+ * Equals to enum class Color2:int
+ */
+enum class Color2
+{
+ RED=2,
+ YELLOW,
+ BLUE
+};
+r2 c2 = Color2::RED;
+cout << static_cast(c2) << endl; //!
+```
+
+- You can specify a specific type to store enum
+
+```c++
+enum class Color3:char; // Forward statement
+
+// Definition
+enum class Color3:char
+{
+ RED='r',
+ BLUE
+};
+char c3 = static_cast(Color3::RED);
+```
+
+Implementation:[classic_practice.cpp](classic_practice.cpp)
+
+## Enum types in class
+
+
+
+Sometimes we want certain constants to work only in classes. Because the macro constant defined by a is global, it can not achieve the purpose, so we want to use const to modify data members.The const data member does exist, but its meaning is not what we expected.
+Data members are constants only for the lifetime of an objec. However, it is variable for the whole class, because the class can create multiple objects, and the values of const data members of different objects can be different.
+
+
+
+Cannot be initialized in a class declaration const data memeber。The following usage is incorrect,Because the compiler does not know what the value of size is when the object of the class is not created.(c++11)
+
+```c++
+class A
+{
+ const int SIZE = 100; // Error,Attempt to initialize const data member in class declaration
+ int array[SIZE]; // Error,Unknown size
+};
+```
+
+This should be done in the initialization list of the class's constructor:
+
+```c++
+class A
+{
+ A(int size); // Constructor
+ const int SIZE ;
+};
+A::A(int size) : SIZE(size) // The definition of Struct
+{
+
+}
+A a(100); // The size of Object A is 100
+A b(200); // The size of Object B is 200
+```
+
+How can I establish constants that are constant throughout a class?
+
+It should be implemented with enumeration constants in the class. Such as:
+
+```c++
+class Person{
+public:
+ typedef enum {
+ BOY = 0,
+ GIRL
+ }SexType;
+};
+//Access via Person::BOY or Person::GIRL.
+```
+
+Enum constants do not take up the storage space of the object . They are all evaluated at compile time
+
+
+Drawback of Enum:Its implied data type is an integer, the maximum is limited, and it cannot represent floating point.
diff --git a/english/basic_content/enum/classic_practice b/english/basic_content/enum/classic_practice
new file mode 100755
index 0000000000000000000000000000000000000000..f9f67b7aad21345bab72ac320341410e3d763f7e
GIT binary patch
literal 9328
zcmeHNeQaCR6~DHVCTWY~LJMgN)Eg}eWid&cW+`a!oW!Zk+&0Sx%Ybm>*iPc%*p~fV
z(rRp}QYx%c$Y7c>O_MT}Nlcms(}cwMqiGe?!lX^G38~tqsY5U&e2lVoD5^@cbM8CG
zetxz$_Vph}@;mqZ?m6e)ckai#_axu;1-tDwn_#kwy9G*fHJXBqrw}jPs6@irMV-*Z
z7IC9k1xPjgG*yG#C^26q*UW24&jGv&e(iPxXt!&sz?_?7&OJnq?G;F)qQReCV~EU!
za4P`qu&>M4C=vLuDlkt`KjyGwirngnFxoXZl?Z%T6_}r=jxp!=!*|19Kl$yqYapSl
zAroEdS>ULP)boxW!E)njB?8w}fq5mnuYw)+^V5=x6nm+?N^z;B{xhf76?epABWG<;T8!n%?|4$FJVI2-7kDCxKVY3;%Mtm*&KKIF`x<=od!40!(J3%Z<+rYuKWopoq
zy9~ai0{&~j%lYZ9;D2`o{GAGZc2;P2e+B$-1wT&{K1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dMYlPYA_*Y|n%
z209C=L`_pELP`r#0x_J)s(^xvf1QRcpX@B_*GT8$3sW^^CZ#MSF)cL^>VG?BYH7Q)
zgP8HPDE-r9@_rcINGu_d_o|sF<6t1OF8ObE&ILr}D
zSsS@q481X{MAkEsjlo}NViDm%X*`q}7oNz$1o$(!o;GR@MAI2q4Ml>4x^y%iLIWzL
z;=1stV0fVD8B2l)iEen}Y6qpH>aZs|PV0L-0!~;mOpS$ZSaA6pVNio+LKCqt^dYIE
zdqD8*JrH%_fh}hOwh`Lg{tJfZEZ8#P>|qe!ANcQ(d=I5+rORdHx4^Fker(V84E{Tx
z8|uu&-z&yipkTJ=`-n~sx3VH}t9=*XAH!Xd+n=>-N^_O~zJFFLv~Zs$QS5^P-i_J*
zRl5d~fP0Q&q6dQmg!gMK)}jCeCnH7o!4p0$d3(N(H&93U{%vR%&VejH1O>eNa{GK=
zdYn4U@#p@t9`lF69`DjD^S$ahGSH|Y>_6&o{|Od&4#uvsJ>S0;$-Ywj`2CNNeFr(@
zds+h}Bu){I?$CzYXZt4s!?==q{yuk(0M3hmiXsXtiy{Xlvwi;Fhm#6u#$frUi%QJD
z3$ods?}syF&;4ZwR{4h(dp?KGk$sv2YiXDLov_&ReRDk}a5!(m`quaV3E6Wqd@gj8
zJ>HT?rbNl>W
zvzGSxzP^kv1;qM>RFE0}5Gu_5&)@5*fk8GT&UVa~E%to>A0&J3C%a)gmajqqF@FCk
zx*v>_A^yF?Om4FPWe3!wO0xxL`&|~C-7#N>J}f#Yo}kpkT2>?-i>TV>wPSWONB!@i
db$l~a?t~w|Kkr|-KFhU#ffA&@uvA*x{|B`$?6m*@
literal 0
HcmV?d00001
diff --git a/english/basic_content/enum/classic_practice.cpp b/english/basic_content/enum/classic_practice.cpp
new file mode 100644
index 0000000..f831521
--- /dev/null
+++ b/english/basic_content/enum/classic_practice.cpp
@@ -0,0 +1,87 @@
+/**
+ * @file classic_practice.cpp
+ * @brief g++ -o classic_practice classic_practice.cpp -std=c++11
+ * @author 光城
+ * @version v1
+ * @date 2019-08-07
+ */
+
+#include
+using namespace std;
+/**
+ * @brief namespace解决作用域不受限
+ */
+namespace Color
+{
+ enum Type
+ {
+ RED=15,
+ YELLOW,
+ BLUE
+ };
+};
+
+/**
+ * @brief 上述如果 using namespace Color 后,前缀还可以省去,使得代码简化。
+ * 不过,因为命名空间是可以随后被扩充内容的,所以它提供的作用域封闭性不高。
+ * 在大项目中,还是有可能不同人给不同的东西起同样的枚举类型名。
+ * 更“有效”的办法是用一个类或结构体来限定其作用域。
+ *
+ * 定义新变量的方法和上面命名空间的相同。
+ * 不过这样就不用担心类在别处被修改内容。
+ * 这里用结构体而非类,一是因为本身希望这些常量可以公开访问,
+ * 二是因为它只包含数据没有成员函数。
+ */
+struct Color1
+{
+ enum Type
+ {
+ RED=102,
+ YELLOW,
+ BLUE
+ };
+};
+
+/**
+ * @brief C++11的枚举类
+ * 下面等价于enum class Color2:int
+ */
+enum class Color2
+{
+ RED=2,
+ YELLOW,
+ BLUE
+};
+
+enum class Color3:char; // 前向声明
+
+// 定义
+enum class Color3:char
+{
+ RED='r',
+ BLUE
+};
+
+int main()
+{
+ // 定义新的枚举变量
+ Color::Type c = Color::RED;
+ cout<(c2) << endl;
+
+ char c3 = static_cast(Color3::RED);
+ cout<
+using namespace std;
+
+enum Color {RED,BLUE};
+enum Feeling {EXCITED,BLUE};
+
+int main()
+{
+ return 0;
+}
From c6b3297af9c678751c6a183f4f655293c9e1d737 Mon Sep 17 00:00:00 2001
From: zgdgod <1092792570@qq.com>
Date: Sat, 18 Jul 2020 21:27:58 +0800
Subject: [PATCH 21/62] Update 2_5_id.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
主要是master_thread只进行了定义,没有赋值,进入main函数之后,才有master_thread_id; 其他就是加了一些输出,看起来直观一点
---
concurrency/concurrency_v1/chapter2/2_5_id.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/concurrency/concurrency_v1/chapter2/2_5_id.cpp b/concurrency/concurrency_v1/chapter2/2_5_id.cpp
index 67b00d7..905aafb 100644
--- a/concurrency/concurrency_v1/chapter2/2_5_id.cpp
+++ b/concurrency/concurrency_v1/chapter2/2_5_id.cpp
@@ -27,8 +27,12 @@ void some_core_part_of_algorithm() {
}
int main() {
- std::cout << std::this_thread::get_id() << endl;
+ master_thread = std::this_thread::get_id();
+ std::cout << "master_thread: " << master_thread << endl;
+ cout << "master_thread 中运行:" << endl;
+ some_core_part_of_algorithm();
+ cout << "thread 中运行:" << endl;
thread t(some_core_part_of_algorithm);
t.join();
return 0;
-}
\ No newline at end of file
+}
From 9f6088a31e80fb0056a2947b754413cfcfe4328e Mon Sep 17 00:00:00 2001
From: xliu79
Date: Sat, 18 Jul 2020 23:30:56 +0800
Subject: [PATCH 22/62] english
---
english/basic_content/c_poly/README.md | 46 +++++++++++++++++
english/basic_content/c_poly/c++_examp | Bin 0 -> 8720 bytes
english/basic_content/c_poly/c++_examp.cpp | 43 ++++++++++++++++
english/basic_content/c_poly/c_examp | Bin 0 -> 8720 bytes
english/basic_content/c_poly/c_examp.c | 55 +++++++++++++++++++++
5 files changed, 144 insertions(+)
create mode 100644 english/basic_content/c_poly/README.md
create mode 100755 english/basic_content/c_poly/c++_examp
create mode 100644 english/basic_content/c_poly/c++_examp.cpp
create mode 100755 english/basic_content/c_poly/c_examp
create mode 100644 english/basic_content/c_poly/c_examp.c
diff --git a/english/basic_content/c_poly/README.md b/english/basic_content/c_poly/README.md
new file mode 100644
index 0000000..59e7c6a
--- /dev/null
+++ b/english/basic_content/c_poly/README.md
@@ -0,0 +1,46 @@
+# Object oriented features of C + + implemented by C
+
+
+## About Author:
+
+
+
+
+## 1.C++
+
+Polymorphism in C ++ :In C++, we usually maintain a virtual function table. According to the assignment compatibility rule, we know that the pointer or reference of the parent class can point to the child class object
+
+
+
+If the pointer or reference of a parent class calls the virtual function of the parent class, the pointer of the parent class will look up its function address in its own virtual function table.If the pointer or reference of the parent object points to an object of a subclass, and the subclass has overridden the virtual function of the parent class, the pointer will call the overridden virtual function of the subclass.
+
+Code Example:[c++_examp.cpp](./c++_examp.cpp)
+
+
+
+## 2.C Implement
+
+- Encapsulation
+
+There is no concept of class class in C language. But with struct structure, we can use struct to simulate;
+
+Encapsulating properties and methods into structures using function pointers.
+
+
+
+- Inherit
+
+Structure nesting
+
+
+- Polymorphic
+
+Class and subclass methods have different function pointers
+
+There is no member function in the structure of C language. How to realize the common function of parent structure and child structure? We can consider using function pointers to simulate. But there is a flaw in this approach:The function pointer between the parent and child does not point to the virtual function table maintained in C ++, but a piece of physical memory. If there are too many simulated functions, it will not be easy to maintain.
+
+In order to simulate polymorphism, function pointer variables must be aligned(They are completely consistent in content and alignment of variables).Otherwise, the parent class pointer points to the child class object, and the operation crashes!
+
+
+
+Code example :[c_examp.c](./c_examp.c)
diff --git a/english/basic_content/c_poly/c++_examp b/english/basic_content/c_poly/c++_examp
new file mode 100755
index 0000000000000000000000000000000000000000..fe986fd26f303345cb71edb58a029c5bf9672f44
GIT binary patch
literal 8720
zcmeHMU2Igx6`tMoAAjqG@M9n<+XN~T)yo=;YoIN6*K2c4*WhA1r7GsK_O9(M_O7*i
z*EKw}R0b4_kXUL|Syd}VY5JEwREd!4hqi#+hD2&5r)v7pCX!1_Y7$66w8$^8{m$Gu
z`*Xc+qDp7a5iwYp+xHMTq+$u3&P_CI*DLof>8LlR$1vEJ|Sz!LS1)~LvI6~soUY;~nwD_l0
z1I&f+%6hV+SUqkjf}fBD=Kfq9Rz2GhOm?-(u2$JGpH+b|=l)UO=;~5_yPO&%k~Lx?
zB=31nxWp?Gg&!;Yb7
z-B3J{8LJy>YOHH)@THT!owDELpL7o#>Xt3>IC>#b|JLH79H9EwLIa1s)BSFAZglUy
zz3;BSy=TXd{bb7*iXWR+KyytAZHlK9{>dfqUBJD#77_a0N8M}`BN;O-3?pqu`c4{s
zgC~vtNPGwYX%Lz+jp0Z<0c2n}nNWx!4u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d00001
diff --git a/english/basic_content/c_poly/c++_examp.cpp b/english/basic_content/c_poly/c++_examp.cpp
new file mode 100644
index 0000000..aee979b
--- /dev/null
+++ b/english/basic_content/c_poly/c++_examp.cpp
@@ -0,0 +1,43 @@
+/**
+ * @file c++_examp.cpp
+ * @brief c++中的多态
+ * @author 光城
+ * @version v1
+ * @date 2019-08-06
+ */
+
+#include
+
+using namespace std;
+class A
+{
+ public:
+ virtual void f()//Implement a virtual function
+ {
+ cout << "Base A::f() " << endl;
+ }
+};
+
+class B:public A // 必须为共有继承,否则后面调用不到,class默认为私有继承!
+{
+ public:
+ virtual void f()//Virtual function implementation, virtual keyword in subclass can not be appearence
+ {
+ cout << "Derived B::f() " << endl;
+ }
+};
+
+
+int main()
+{
+ A a;//Base class object
+ B b;//an object of derived type
+
+ A* pa = &a;//The parent class pointer points to the parent object
+ pa->f();//Call the function of the parent class
+ pa = &b; //The parent class pointer points to the subclass object, which is implemented in polymorphism
+
+
+ pa->f();//Call the function with the same name of the derived class
+ return 0;
+}
diff --git a/english/basic_content/c_poly/c_examp b/english/basic_content/c_poly/c_examp
new file mode 100755
index 0000000000000000000000000000000000000000..458fb2a5db728b32f9b99b15c7b598fb0f65583a
GIT binary patch
literal 8720
zcmeHMU2Igx6`tMoAAjqGKw=;&+XN&N$(J=4*O0c{UH@=R*WemEO;yZg?Ooej>|Ja3
zE;XoXQyFM1LSm^^<(En*C9Rr1G^vnksXsv6hD4&3(*
z0COSyvYzZHR-adj;74SEc_0^uUC(v|lU=Q{t5tT)XH{U#xqs9*db*Y0ZnqAJWSy93
zk?%YwU82rwR+P$bQlpaVMSLl{&%;icNd1p``IJJJYHz8$+*JKzu0*kIINsOTux&V6
zHylr7#_GnJ8tWPxv~*J2F8fXXNq6u59@!G-(GQ9Gw-yi00jmFI`-7sPg(;7PRF>k|~tyvr>MZ
zWD4Q>B`Nno9+)HpqWTZoC*C-0O#HADOk6v*ahg0)*sFUlQbl$S$|ngFy)zW$fX4DKslLbf#^0o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L$w(f61jCR0WE;5S>
zv*nBXgB|V7&?=~r_mhBd|7x}xrtQsW=@RDN@PSY;Y#wN9JJ{N7b_YY@R%$`sYWAly
zvID|w@9r@3sp;-$ro?nd`i5ijUR2llnv*U!+cJruFk{h(6@jPX3)8$NWz2DRny(}`
z$T~dO7pV}6ZdFm2PMSlJL=+L2?FXP0jVH`ZI))77gQpBoI3a+2>9q1?U(@b8W_GEe
zZXS-L({h~AGfpyfndd@LhlQ3tK4L}sz^#U}
zeVI6}(Bn~|ku(%Z4+$-LJOO_;w^DY^u~;e{PbP{46LqQBaD)t0X>`~Un(U*7qBfX>
zXvN0xrfCPIq#Oe+Hl!xnP!vvBvQ6z7XIpUj%l%M8Gm(*aKVnE)F}vdEPJb|1kbSWt4fnW4IoLLVMm<
zTFT*OR#e<+-vay&_VV2Rlv|gYQwret%O#pW?
zLmxG$fjU<}&iv6n)r&_>m)yCA{~vYgJ7wA*RTtRv`KN}Qf}HwJ`Onay5V?ImXZSy+
z{kyQGRI@#wr}+QtS=E0v9JzRS9!xpf=l>NKs8b+kyeu>SJ9G-;7rakY4Fsf@{EO|F
zFF5RZe;ZKt94C8VJC^UEKp6L*_l3GLbn2^gu(|L6Aj}yj+tWX_g~ayEX@ARY7wWaB
w3$c}~s45+zY@5HGLi;fl|D+nYPoQ!e9_|mXi}Zb#YQIWdV13%*+}Zwr0KepfGXMYp
literal 0
HcmV?d00001
diff --git a/english/basic_content/c_poly/c_examp.c b/english/basic_content/c_poly/c_examp.c
new file mode 100644
index 0000000..7798d3e
--- /dev/null
+++ b/english/basic_content/c_poly/c_examp.c
@@ -0,0 +1,55 @@
+/**
+ * @file c_examp.c
+ * @brief C实现多态
+ * @author 光城
+ * @version v1
+ * @date 2019-08-06
+ */
+
+#include
+
+/// Define a pointer of function
+typedef void (*pf) ();
+
+/**
+ * @brief parent class
+ */
+typedef struct _A
+{
+ pf _f;
+}A;
+
+
+/**
+ * @brief child class
+ */
+typedef struct _B
+{
+ A _b; ///< The inheritance of the parent class can be realized by defining an object of the base class in the subclass
+}B;
+
+void FunA()
+{
+ printf("%s\n","Base A::fun()");
+}
+
+void FunB()
+{
+ printf("%s\n","Derived B::fun()");
+}
+
+
+int main()
+{
+ A a;
+ B b;
+
+ a._f = FunA;
+ b._b._f = FunB;
+
+ A *pa = &a;
+ pa->_f();
+ pa = (A *)&b; /// The parent class pointer points to the object of the subclass. Because of the type mismatch, it needs to be forced
+ pa->_f();
+ return 0;
+}
From 2bdeea85d16ffb02359f437f44676f6b8e899073 Mon Sep 17 00:00:00 2001
From: xliu79
Date: Sun, 19 Jul 2020 10:38:38 +0800
Subject: [PATCH 23/62] english
---
english/basic_content/abstract/README.md | 140 ++++++++++
english/basic_content/abstract/abstract.cpp | 27 ++
.../basic_content/abstract/derived_full.cpp | 32 +++
.../abstract/interesting_facts1.cpp | 28 ++
.../abstract/interesting_facts2.cpp | 38 +++
.../abstract/interesting_facts3.cpp | 29 ++
.../abstract/interesting_facts4.cpp | 35 +++
.../abstract/interesting_facts5.cpp | 30 +++
.../basic_content/abstract/pure_virtual.cpp | 34 +++
english/basic_content/abstract/test.cpp | 23 ++
english/basic_content/assert/README.md | 61 +++++
english/basic_content/assert/assert.c | 18 ++
english/basic_content/assert/ignore_assert.c | 17 ++
english/basic_content/bit/README.md | 177 +++++++++++++
english/basic_content/bit/learn.cpp | 19 ++
english/basic_content/decltype/README.md | 138 ++++++++++
english/basic_content/decltype/decltype | Bin 0 -> 22080 bytes
english/basic_content/decltype/decltype.cpp | 60 +++++
english/basic_content/explicit/README.md | 16 ++
english/basic_content/explicit/explicit | Bin 0 -> 9288 bytes
english/basic_content/explicit/explicit.cpp | 46 ++++
english/basic_content/extern/README.md | 193 ++++++++++++++
english/basic_content/extern/extern_c++/add.c | 5 +
.../basic_content/extern/extern_c++/add.cpp | 9 +
english/basic_content/extern/extern_c++/add.h | 4 +
english/basic_content/extern/extern_c++/add.o | Bin 0 -> 1248 bytes
english/basic_content/extern/extern_c++/main | Bin 0 -> 8960 bytes
english/basic_content/extern/extern_c/add.c | 5 +
english/basic_content/extern/extern_c/add.cpp | 5 +
english/basic_content/extern/extern_c/add.h | 6 +
english/basic_content/extern/extern_c/add.o | Bin 0 -> 1248 bytes
english/basic_content/extern/extern_c/main | Bin 0 -> 8608 bytes
english/basic_content/friend/README.md | 115 ++++++++
english/basic_content/friend/friend_class | Bin 0 -> 9344 bytes
english/basic_content/friend/friend_class.cpp | 28 ++
english/basic_content/friend/friend_func | Bin 0 -> 9336 bytes
english/basic_content/friend/friend_func.cpp | 33 +++
english/basic_content/func_pointer/func1 | Bin 0 -> 9368 bytes
.../func_pointer/func_pointer.cpp | 33 +++
english/basic_content/img/wechat.jpg | Bin 0 -> 28028 bytes
english/basic_content/inline/README.md | 137 ++++++++++
english/basic_content/inline/inline | Bin 0 -> 9200 bytes
english/basic_content/inline/inline.cpp | 57 ++++
english/basic_content/inline/inline.h | 19 ++
.../basic_content/inline/inline_virtual.cpp | 35 +++
english/basic_content/inline/iv | Bin 0 -> 14376 bytes
english/basic_content/macro/README.md | 232 ++++++++++++++++
english/basic_content/macro/do_while | Bin 0 -> 9464 bytes
english/basic_content/macro/do_while.cpp | 76 ++++++
english/basic_content/macro/sig_examp | Bin 0 -> 14360 bytes
english/basic_content/macro/sig_examp.cpp | 86 ++++++
english/basic_content/maohao/.README.md.un~ | Bin 0 -> 1052 bytes
english/basic_content/maohao/README.md | 14 +
english/basic_content/maohao/README.md~ | 14 +
english/basic_content/maohao/maohao.cpp | 20 ++
english/basic_content/pointer_refer/README.md | 174 ++++++++++++
.../pointer_refer/copy_construct | Bin 0 -> 9592 bytes
.../pointer_refer/copy_construct.cpp | 35 +++
english/basic_content/pointer_refer/effec | Bin 0 -> 20576 bytes
english/basic_content/pointer_refer/effec.cpp | 22 ++
english/basic_content/sizeof/README.md | 191 ++++++++++++++
english/basic_content/sizeof/blackclass.cpp | 18 ++
english/basic_content/sizeof/genA.cpp | 29 ++
english/basic_content/sizeof/geninhe.cpp | 62 +++++
english/basic_content/sizeof/moreinhe.cpp | 43 +++
english/basic_content/sizeof/morevir.cpp | 24 ++
english/basic_content/sizeof/static.cpp | 33 +++
english/basic_content/sizeof/virinhe.cpp | 38 +++
english/basic_content/sizeof/virmoreinhe.cpp | 38 +++
english/basic_content/static/README.md | 248 ++++++++++++++++++
english/basic_content/static/demo | Bin 0 -> 9104 bytes
.../basic_content/static/nostatic_class.cpp | 28 ++
english/basic_content/static/static_class.cpp | 28 ++
english/basic_content/static/static_demo.cpp | 24 ++
.../static/static_error_variable.cpp | 26 ++
.../basic_content/static/static_funciton.cpp | 20 ++
.../basic_content/static/static_variable.cpp | 24 ++
english/basic_content/struct/README.md | 228 ++++++++++++++++
english/basic_content/struct/ext | Bin 0 -> 14536 bytes
.../basic_content/struct/ext_struct_func.cpp | 33 +++
english/basic_content/struct/sf | Bin 0 -> 8992 bytes
english/basic_content/struct/stff | Bin 0 -> 9152 bytes
english/basic_content/struct/struct_func | Bin 0 -> 8768 bytes
english/basic_content/struct/struct_func.c | 27 ++
english/basic_content/struct/struct_func.cpp | 25 ++
.../basic_content/struct/struct_func_func.cpp | 39 +++
english/basic_content/struct/stu | Bin 0 -> 9112 bytes
english/basic_content/struct_class/README.md | 19 ++
english/basic_content/this/README.md | 89 +++++++
english/basic_content/this/img/constthis.png | Bin 0 -> 28641 bytes
english/basic_content/this/img/genthis.png | Bin 0 -> 34264 bytes
.../basic_content/this/img/thiscontrust.png | Bin 0 -> 59227 bytes
english/basic_content/this/person | Bin 0 -> 33952 bytes
english/basic_content/this/person.cpp | 41 +++
english/basic_content/union/README.md | 18 ++
english/basic_content/union/union | Bin 0 -> 9704 bytes
english/basic_content/union/union.cpp | 50 ++++
english/basic_content/using/README.md | 120 +++++++++
english/basic_content/using/derived_base | Bin 0 -> 15168 bytes
english/basic_content/using/derived_base.cpp | 48 ++++
english/basic_content/using/using_derived | Bin 0 -> 9320 bytes
english/basic_content/using/using_derived.cpp | 36 +++
english/basic_content/using/using_global | Bin 0 -> 9296 bytes
english/basic_content/using/using_global.cpp | 45 ++++
english/basic_content/using/using_typedef | Bin 0 -> 22024 bytes
english/basic_content/using/using_typedef.cpp | 34 +++
english/basic_content/virtual/README.md | 102 +++++++
english/basic_content/virtual/set1/emp | Bin 0 -> 14464 bytes
english/basic_content/virtual/set1/emp.cpp | 52 ++++
.../virtual/set2/default_arg.cpp | 39 +++
.../virtual/set3/copy_consrtuct.cpp | 41 +++
.../basic_content/virtual/set3/full_virde.cpp | 39 +++
.../virtual/set3/inline_virtual.cpp | 35 +++
.../virtual/set3/static_error.cpp | 13 +
.../basic_content/virtual/set3/vir_con.cpp | 206 +++++++++++++++
english/basic_content/virtual/set3/vir_de.cpp | 41 +++
.../virtual/set3/virtual_function.cpp | 33 +++
.../virtual/set3/virtual_function1.cpp | 22 ++
.../virtual/set3/virtual_inline.cpp | 44 ++++
english/basic_content/virtual/set4/rtti | Bin 0 -> 14944 bytes
english/basic_content/virtual/set4/rtti.cpp | 34 +++
.../basic_content/virtual/set4/warn_rtti.cpp | 35 +++
english/basic_content/volatile/README.md | 122 +++++++++
english/basic_content/volatile/noopt_vola.cpp | 15 ++
english/basic_content/volatile/nv | Bin 0 -> 8672 bytes
english/basic_content/volatile/volatile.cpp | 16 ++
english/basic_content/vptr_vtable/README.md | 219 ++++++++++++++++
.../basic_content/vptr_vtable/img/base.jpg | Bin 0 -> 136050 bytes
english/basic_content/vptr_vtable/vptr1.cpp | 105 ++++++++
129 files changed, 5264 insertions(+)
create mode 100644 english/basic_content/abstract/README.md
create mode 100644 english/basic_content/abstract/abstract.cpp
create mode 100644 english/basic_content/abstract/derived_full.cpp
create mode 100644 english/basic_content/abstract/interesting_facts1.cpp
create mode 100644 english/basic_content/abstract/interesting_facts2.cpp
create mode 100644 english/basic_content/abstract/interesting_facts3.cpp
create mode 100644 english/basic_content/abstract/interesting_facts4.cpp
create mode 100644 english/basic_content/abstract/interesting_facts5.cpp
create mode 100644 english/basic_content/abstract/pure_virtual.cpp
create mode 100644 english/basic_content/abstract/test.cpp
create mode 100644 english/basic_content/assert/README.md
create mode 100644 english/basic_content/assert/assert.c
create mode 100644 english/basic_content/assert/ignore_assert.c
create mode 100644 english/basic_content/bit/README.md
create mode 100644 english/basic_content/bit/learn.cpp
create mode 100644 english/basic_content/decltype/README.md
create mode 100755 english/basic_content/decltype/decltype
create mode 100644 english/basic_content/decltype/decltype.cpp
create mode 100644 english/basic_content/explicit/README.md
create mode 100755 english/basic_content/explicit/explicit
create mode 100644 english/basic_content/explicit/explicit.cpp
create mode 100644 english/basic_content/extern/README.md
create mode 100644 english/basic_content/extern/extern_c++/add.c
create mode 100644 english/basic_content/extern/extern_c++/add.cpp
create mode 100644 english/basic_content/extern/extern_c++/add.h
create mode 100644 english/basic_content/extern/extern_c++/add.o
create mode 100755 english/basic_content/extern/extern_c++/main
create mode 100644 english/basic_content/extern/extern_c/add.c
create mode 100644 english/basic_content/extern/extern_c/add.cpp
create mode 100644 english/basic_content/extern/extern_c/add.h
create mode 100644 english/basic_content/extern/extern_c/add.o
create mode 100755 english/basic_content/extern/extern_c/main
create mode 100644 english/basic_content/friend/README.md
create mode 100755 english/basic_content/friend/friend_class
create mode 100644 english/basic_content/friend/friend_class.cpp
create mode 100755 english/basic_content/friend/friend_func
create mode 100644 english/basic_content/friend/friend_func.cpp
create mode 100755 english/basic_content/func_pointer/func1
create mode 100644 english/basic_content/func_pointer/func_pointer.cpp
create mode 100755 english/basic_content/img/wechat.jpg
create mode 100644 english/basic_content/inline/README.md
create mode 100755 english/basic_content/inline/inline
create mode 100644 english/basic_content/inline/inline.cpp
create mode 100644 english/basic_content/inline/inline.h
create mode 100644 english/basic_content/inline/inline_virtual.cpp
create mode 100755 english/basic_content/inline/iv
create mode 100644 english/basic_content/macro/README.md
create mode 100755 english/basic_content/macro/do_while
create mode 100644 english/basic_content/macro/do_while.cpp
create mode 100755 english/basic_content/macro/sig_examp
create mode 100644 english/basic_content/macro/sig_examp.cpp
create mode 100644 english/basic_content/maohao/.README.md.un~
create mode 100644 english/basic_content/maohao/README.md
create mode 100644 english/basic_content/maohao/README.md~
create mode 100644 english/basic_content/maohao/maohao.cpp
create mode 100644 english/basic_content/pointer_refer/README.md
create mode 100755 english/basic_content/pointer_refer/copy_construct
create mode 100644 english/basic_content/pointer_refer/copy_construct.cpp
create mode 100755 english/basic_content/pointer_refer/effec
create mode 100644 english/basic_content/pointer_refer/effec.cpp
create mode 100644 english/basic_content/sizeof/README.md
create mode 100644 english/basic_content/sizeof/blackclass.cpp
create mode 100644 english/basic_content/sizeof/genA.cpp
create mode 100644 english/basic_content/sizeof/geninhe.cpp
create mode 100644 english/basic_content/sizeof/moreinhe.cpp
create mode 100644 english/basic_content/sizeof/morevir.cpp
create mode 100644 english/basic_content/sizeof/static.cpp
create mode 100644 english/basic_content/sizeof/virinhe.cpp
create mode 100644 english/basic_content/sizeof/virmoreinhe.cpp
create mode 100644 english/basic_content/static/README.md
create mode 100755 english/basic_content/static/demo
create mode 100644 english/basic_content/static/nostatic_class.cpp
create mode 100644 english/basic_content/static/static_class.cpp
create mode 100644 english/basic_content/static/static_demo.cpp
create mode 100644 english/basic_content/static/static_error_variable.cpp
create mode 100644 english/basic_content/static/static_funciton.cpp
create mode 100644 english/basic_content/static/static_variable.cpp
create mode 100644 english/basic_content/struct/README.md
create mode 100755 english/basic_content/struct/ext
create mode 100644 english/basic_content/struct/ext_struct_func.cpp
create mode 100755 english/basic_content/struct/sf
create mode 100755 english/basic_content/struct/stff
create mode 100755 english/basic_content/struct/struct_func
create mode 100644 english/basic_content/struct/struct_func.c
create mode 100644 english/basic_content/struct/struct_func.cpp
create mode 100644 english/basic_content/struct/struct_func_func.cpp
create mode 100755 english/basic_content/struct/stu
create mode 100644 english/basic_content/struct_class/README.md
create mode 100644 english/basic_content/this/README.md
create mode 100644 english/basic_content/this/img/constthis.png
create mode 100644 english/basic_content/this/img/genthis.png
create mode 100644 english/basic_content/this/img/thiscontrust.png
create mode 100755 english/basic_content/this/person
create mode 100644 english/basic_content/this/person.cpp
create mode 100644 english/basic_content/union/README.md
create mode 100755 english/basic_content/union/union
create mode 100644 english/basic_content/union/union.cpp
create mode 100644 english/basic_content/using/README.md
create mode 100755 english/basic_content/using/derived_base
create mode 100644 english/basic_content/using/derived_base.cpp
create mode 100755 english/basic_content/using/using_derived
create mode 100644 english/basic_content/using/using_derived.cpp
create mode 100755 english/basic_content/using/using_global
create mode 100644 english/basic_content/using/using_global.cpp
create mode 100755 english/basic_content/using/using_typedef
create mode 100644 english/basic_content/using/using_typedef.cpp
create mode 100644 english/basic_content/virtual/README.md
create mode 100755 english/basic_content/virtual/set1/emp
create mode 100644 english/basic_content/virtual/set1/emp.cpp
create mode 100644 english/basic_content/virtual/set2/default_arg.cpp
create mode 100644 english/basic_content/virtual/set3/copy_consrtuct.cpp
create mode 100644 english/basic_content/virtual/set3/full_virde.cpp
create mode 100644 english/basic_content/virtual/set3/inline_virtual.cpp
create mode 100644 english/basic_content/virtual/set3/static_error.cpp
create mode 100644 english/basic_content/virtual/set3/vir_con.cpp
create mode 100644 english/basic_content/virtual/set3/vir_de.cpp
create mode 100644 english/basic_content/virtual/set3/virtual_function.cpp
create mode 100644 english/basic_content/virtual/set3/virtual_function1.cpp
create mode 100644 english/basic_content/virtual/set3/virtual_inline.cpp
create mode 100755 english/basic_content/virtual/set4/rtti
create mode 100644 english/basic_content/virtual/set4/rtti.cpp
create mode 100644 english/basic_content/virtual/set4/warn_rtti.cpp
create mode 100644 english/basic_content/volatile/README.md
create mode 100644 english/basic_content/volatile/noopt_vola.cpp
create mode 100755 english/basic_content/volatile/nv
create mode 100644 english/basic_content/volatile/volatile.cpp
create mode 100644 english/basic_content/vptr_vtable/README.md
create mode 100644 english/basic_content/vptr_vtable/img/base.jpg
create mode 100644 english/basic_content/vptr_vtable/vptr1.cpp
diff --git a/english/basic_content/abstract/README.md b/english/basic_content/abstract/README.md
new file mode 100644
index 0000000..e11aa35
--- /dev/null
+++ b/english/basic_content/abstract/README.md
@@ -0,0 +1,140 @@
+# 纯虚函数和抽象类
+
+## 关于作者:
+
+个人公众号:
+
+
+
+## 1.纯虚函数与抽象类
+
+C++中的纯虚函数(或抽象函数)是我们没有实现的虚函数!我们只需声明它! 通过声明中赋值0来声明纯虚函数!
+```cpp
+// 抽象类
+Class A {
+public:
+ virtual void show() = 0; // 纯虚函数
+ /* Other members */
+};
+```
+
+ * 纯虚函数:没有函数体的虚函数
+ * 抽象类:包含纯虚函数的类
+
+抽象类只能作为基类来派生新类使用,不能创建抽象类的对象,抽象类的指针和引用->由抽象类派生出来的类的对象!
+
+> 代码样例:[test.cpp](./test.cpp)、[pure_virtual.cpp](./pure_virtual.cpp)
+
+## 2.实现抽象类
+
+抽象类中:在成员函数内可以调用纯虚函数,在构造函数/析构函数内部不能使用纯虚函数。
+
+如果一个类从抽象类派生而来,它必须实现了基类中的所有纯虚函数,才能成为非抽象类。
+```cpp
+// A为抽象类
+class A {
+public:
+ virtual void f() = 0; // 纯虚函数
+ void g(){ this->f(); }
+ A(){} // 构造函数
+};
+
+class B : public A{
+public:
+ void f(){ cout<<"B:f()"< 代码样例:[abstract.cpp](./abstract.cpp)
+
+## 3.重要点
+
+- [纯虚函数使一个类变成抽象类](./interesting_facts1.cpp)
+```cpp
+// 抽象类至少包含一个纯虚函数
+class Base{
+public:
+ virtual void show() = 0; // 纯虚函数
+ int getX() { return x; } // 普通成员函数
+
+private:
+ int x;
+};
+```
+
+- [抽象类类型的指针和引用](./interesting_facts2.cpp)
+```cpp
+class Derived : public Base {
+public:
+ void show() { cout << "In Derived \n"; } // 实现抽象类的纯虚函数
+ Derived(){} // 构造函数
+};
+
+int main(void)
+{
+ //Base b; // error! 不能创建抽象类的对象
+ //Base *b = new Base(); error!
+
+ Base *bp = new Derived(); // 抽象类的指针和引用 -> 由抽象类派生出来的类的对象
+ bp->show();
+ return 0;
+}
+```
+
+- [如果我们不在派生类中覆盖纯虚函数,那么派生类也会变成抽象类](./interesting_facts3.cpp)
+```cpp
+// Derived为抽象类
+class Derived: public Base
+{
+public:
+// void show() {}
+};
+```
+
+- [抽象类可以有构造函数](./interesting_facts4.cpp)
+```cpp
+// 抽象类
+class Base {
+ protected:
+ int x;
+ public:
+ virtual void fun() = 0;
+ Base(int i) { x = i; } // 构造函数
+};
+// 派生类
+class Derived: public Base
+{
+ int y;
+public:
+ Derived(int i, int j) : Base(i) { y = j; } // 构造函数
+ void fun() { cout << "x = " << x << ", y = " << y; }
+};
+```
+
+- [构造函数不能是虚函数,而析构函数可以是虚析构函数](./interesting_facts5.cpp)
+```cpp
+// 抽象类
+class Base {
+public:
+ Base(){ cout << "Constructor: Base" << endl; }
+ virtual ~Base(){ cout << "Destructor : Base" << endl; }
+
+ virtual void func() = 0;
+};
+
+class Derived: public Base {
+public:
+ Derived(){ cout << "Constructor: Derived" << endl; }
+ ~Derived(){ cout << "Destructor : Derived" << endl;}
+
+ void func(){cout << "In Derived.func()." << endl;}
+};
+```
+>当基类指针指向派生类对象并删除对象时,我们可能希望调用适当的析构函数。
+> 如果析构函数不是虚拟的,则只能调用基类析构函数。
+
+## 4.完整实例
+
+抽象类由派生类继承实现!
+
+> 代码样例:[derived_full.cpp](./derived_full.cpp)
\ No newline at end of file
diff --git a/english/basic_content/abstract/abstract.cpp b/english/basic_content/abstract/abstract.cpp
new file mode 100644
index 0000000..3a26d99
--- /dev/null
+++ b/english/basic_content/abstract/abstract.cpp
@@ -0,0 +1,27 @@
+/**
+ * @file abstract.cpp
+ * @brief 抽象类中:在成员函数内可以调用纯虚函数,在构造函数/析构函数内部不能使用纯虚函数
+ * 如果一个类从抽象类派生而来,它必须实现了基类中的所有纯虚函数,才能成为非抽象类
+ * @author 光城
+ * @version v1
+ * @date 2019-07-20
+ */
+
+#include
+using namespace std;
+
+class A {
+public:
+ virtual void f() = 0; // 纯虚函数
+ void g(){ this->f(); }
+ A(){}
+};
+class B:public A{
+public:
+ void f(){ cout<<"B:f()"<
+using namespace std;
+
+class Base
+{
+ int x;
+ public:
+ virtual void fun() = 0;
+ int getX() { return x; }
+};
+
+class Derived: public Base
+{
+ int y;
+ public:
+ void fun() { cout << "fun() called"; } // 实现了fun()函数
+};
+
+int main(void)
+{
+ Derived d;
+ d.fun();
+ return 0;
+}
diff --git a/english/basic_content/abstract/interesting_facts1.cpp b/english/basic_content/abstract/interesting_facts1.cpp
new file mode 100644
index 0000000..048ede7
--- /dev/null
+++ b/english/basic_content/abstract/interesting_facts1.cpp
@@ -0,0 +1,28 @@
+/**
+ * @file interesting_facts1.cpp
+ * @brief 纯虚函数使一个类变成抽象类
+ * @author 光城
+ * @version v1
+ * @date 2019-07-20
+ */
+
+#include
+using namespace std;
+
+/**
+ * @brief 抽象类至少包含一个纯虚函数
+ */
+class Test
+{
+ int x;
+public:
+ virtual void show() = 0;
+ int getX() { return x; }
+};
+
+int main(void)
+{
+ Test t; //error! 不能创建抽象类的对象
+ return 0;
+}
+
diff --git a/english/basic_content/abstract/interesting_facts2.cpp b/english/basic_content/abstract/interesting_facts2.cpp
new file mode 100644
index 0000000..84d293e
--- /dev/null
+++ b/english/basic_content/abstract/interesting_facts2.cpp
@@ -0,0 +1,38 @@
+/**
+ * @file interesting_facts2.cpp
+ * @brief 抽象类类型的指针和引用
+ * @author 光城
+ * @version v1
+ * @date 2019-07-20
+ */
+
+#include
+using namespace std;
+
+
+/**
+ * @brief 抽象类至少包含一个纯虚函数
+ */
+class Base
+{
+ int x;
+public:
+ virtual void show() = 0;
+ int getX() { return x; }
+
+};
+class Derived: public Base
+{
+public:
+ void show() { cout << "In Derived \n"; }
+ Derived(){}
+};
+int main(void)
+{
+ //Base b; //error! 不能创建抽象类的对象
+ //Base *b = new Base(); error!
+ Base *bp = new Derived(); // 抽象类的指针和引用 -> 由抽象类派生出来的类的对象
+ bp->show();
+ return 0;
+}
+
diff --git a/english/basic_content/abstract/interesting_facts3.cpp b/english/basic_content/abstract/interesting_facts3.cpp
new file mode 100644
index 0000000..fb76824
--- /dev/null
+++ b/english/basic_content/abstract/interesting_facts3.cpp
@@ -0,0 +1,29 @@
+/**
+ * @file interesting_facts3.cpp
+ * @brief 如果我们不在派生类中覆盖纯虚函数,那么派生类也会变成抽象类。
+ * @author 光城
+ * @version v1
+ * @date 2019-07-20
+ */
+
+#include
+using namespace std;
+
+class Base
+{
+ int x;
+public:
+ virtual void show() = 0;
+ int getX() { return x; }
+};
+class Derived: public Base
+{
+public:
+// void show() { }
+};
+int main(void)
+{
+ Derived d; //error! 派生类没有实现纯虚函数,那么派生类也会变为抽象类,不能创建抽象类的对象
+ return 0;
+}
+
diff --git a/english/basic_content/abstract/interesting_facts4.cpp b/english/basic_content/abstract/interesting_facts4.cpp
new file mode 100644
index 0000000..028554b
--- /dev/null
+++ b/english/basic_content/abstract/interesting_facts4.cpp
@@ -0,0 +1,35 @@
+/**
+ * @file interesting_facts4.cpp
+ * @brief 抽象类可以有构造函数
+ * @author 光城
+ * @version v1
+ * @date 2019-07-20
+ */
+
+#include
+using namespace std;
+
+// An abstract class with constructor
+class Base
+{
+ protected:
+ int x;
+ public:
+ virtual void fun() = 0;
+ Base(int i) { x = i; }
+};
+
+class Derived: public Base
+{
+ int y;
+ public:
+ Derived(int i, int j):Base(i) { y = j; }
+ void fun() { cout << "x = " << x << ", y = " << y; }
+};
+
+int main(void)
+{
+ Derived d(4, 5);
+ d.fun();
+ return 0;
+}
diff --git a/english/basic_content/abstract/interesting_facts5.cpp b/english/basic_content/abstract/interesting_facts5.cpp
new file mode 100644
index 0000000..e9152b9
--- /dev/null
+++ b/english/basic_content/abstract/interesting_facts5.cpp
@@ -0,0 +1,30 @@
+
+/**
+ * @file interesting_facts5.cpp
+ * @brief 构造函数不能是虚函数,而析构函数可以是虚析构函数。
+ * 例如:当基类指针指向派生类对象并删除对象时,我们可能希望调用适当的析构函数。如果析构函数不是虚拟的,则只能调用基类析构函数。
+ * @author 光城
+ * @version v1
+ * @date 2019-07-20
+ */
+#include
+using namespace std;
+
+class Base {
+ public:
+ Base() { cout << "Constructor: Base" << endl; }
+ virtual ~Base() { cout << "Destructor : Base" << endl; }
+};
+
+class Derived: public Base {
+ public:
+ Derived() { cout << "Constructor: Derived" << endl; }
+ ~Derived() { cout << "Destructor : Derived" << endl; }
+};
+
+int main() {
+ Base *Var = new Derived();
+ delete Var;
+ return 0;
+}
+
diff --git a/english/basic_content/abstract/pure_virtual.cpp b/english/basic_content/abstract/pure_virtual.cpp
new file mode 100644
index 0000000..bfaf177
--- /dev/null
+++ b/english/basic_content/abstract/pure_virtual.cpp
@@ -0,0 +1,34 @@
+/**
+ * @file pure_virtual.cpp
+ * @brief 纯虚函数:没有函数体的虚函数
+ * 抽象类:包含纯虚函数的类
+ *
+ * @author 光城
+ * @version v1
+ * @date 2019-07-20
+ */
+
+#include
+
+using namespace std;
+class A
+{
+private:
+ int a;
+public:
+ virtual void show()=0; // 纯虚函数
+};
+
+
+int main()
+{
+ /*
+ * 1. 抽象类只能作为基类来派生新类使用
+ * 2. 抽象类的指针和引用->由抽象类派生出来的类的对象!
+ */
+ A a; // error 抽象类,不能创建对象
+
+ A *a1; // ok 可以定义抽象类的指针
+
+ A *a2 = new A(); // error, A是抽象类,不能创建对象
+}
diff --git a/english/basic_content/abstract/test.cpp b/english/basic_content/abstract/test.cpp
new file mode 100644
index 0000000..7797c90
--- /dev/null
+++ b/english/basic_content/abstract/test.cpp
@@ -0,0 +1,23 @@
+/**
+ * @file test.cpp
+ * @brief C++中的纯虚函数(或抽象函数)是我们没有实现的虚函数!我们只需声明它!通过声明中赋值0来声明纯虚函数!
+ * 纯虚函数:没有函数体的虚函数
+ * @author 光城
+ * @version v1
+ * @date 2019-07-20
+ */
+
+
+
+/**
+ * @brief 抽象类
+ */
+class Test
+{
+ // Data members of class
+public:
+ // Pure Virtual Function
+ virtual void show() = 0;
+
+ /* Other members */
+};
diff --git a/english/basic_content/assert/README.md b/english/basic_content/assert/README.md
new file mode 100644
index 0000000..8699eff
--- /dev/null
+++ b/english/basic_content/assert/README.md
@@ -0,0 +1,61 @@
+# assert那些事
+
+## 关于作者:
+
+个人公众号:
+
+
+
+
+
+## 1.第一个断言案例
+
+断言,**是宏,而非函数**。
+
+assert 宏的原型定义在 (C)、(C++)中。其作用是如果它的条件返回错误,则终止程序执行。
+
+可以通过定义 `NDEBUG` 来关闭 assert,**但是需要在源代码的开头,include 之前。**
+
+```c
+void assert(int expression);
+```
+
+> 代码样例:[assert.c](./assert.c)
+```c
+#include
+#include
+
+int main()
+{
+ int x = 7;
+
+ /* Some big code in between and let's say x
+ is accidentally changed to 9 */
+ x = 9;
+
+ // Programmer assumes x to be 7 in rest of the code
+ assert(x==7);
+
+ /* Rest of the code */
+
+ return 0;
+}
+```
+输出:
+```c
+assert: assert.c:13: main: Assertion 'x==7' failed.
+```
+可以看到输出会把源码文件,行号错误位置,提示出来!
+
+## 2.断言与正常错误处理
+
++ 断言主要用于检查逻辑上不可能的情况。
+
+>例如,它们可用于检查代码在开始运行之前所期望的状态,或者在运行完成后检查状态。与正常的错误处理不同,断言通常在运行时被禁用。
+
++ 忽略断言,在代码开头加上:
+```c++
+#define NDEBUG // 加上这行,则 assert 不可用
+```
+
+> 样例代码:[ignore_assert.c](./ignore_assert.c)
diff --git a/english/basic_content/assert/assert.c b/english/basic_content/assert/assert.c
new file mode 100644
index 0000000..f66a2c0
--- /dev/null
+++ b/english/basic_content/assert/assert.c
@@ -0,0 +1,18 @@
+#include
+#include
+
+int main()
+{
+ int x = 7;
+
+ /* Some big code in between and let's say x
+ * is accidentally changed to 9 */
+ x = 9;
+
+ // Programmer assumes x to be 7 in rest of the code
+ assert(x==7);
+
+ /* Rest of the code */
+
+ return 0;
+}
diff --git a/english/basic_content/assert/ignore_assert.c b/english/basic_content/assert/ignore_assert.c
new file mode 100644
index 0000000..0a5a15e
--- /dev/null
+++ b/english/basic_content/assert/ignore_assert.c
@@ -0,0 +1,17 @@
+/**
+ * @file ignore_assert.c
+ * @brief 忽略断言
+ * @author 光城
+ * @version v1
+ * @date 2019-07-25
+ */
+
+# define NDEBUG // 忽略断言
+
+#include
+
+int main(){
+ int x=7;
+ assert(x==5);
+ return 0;
+}
diff --git a/english/basic_content/bit/README.md b/english/basic_content/bit/README.md
new file mode 100644
index 0000000..498ed23
--- /dev/null
+++ b/english/basic_content/bit/README.md
@@ -0,0 +1,177 @@
+## About Author:
+
+
+
+
+## What is Bit field ?
+
+“ Bit field is a kind of data structure.Data can be stored compactly in bits, And allows the programmer to operate on the bits of this structure. One of the advantages of this data structure is that it can save storage space in data units, which is particularly important when programs need thousands of data units. The second advantage is that bit segments can easily access part of the contents of an integer value, which can simplify the program source code. The disadvantage of this data structure is that bit segment implementation depends on specific machines and systems, and different results may be obtained in different platforms, which leads to the fact that bit segments are not portable in nature
+
+- The layout of bit fields in memory is machine dependent
+- The type of bit field must be integer or enumeration type. The behavior of bit field in signed type depends on the implementation
+- The addressing operator (&) cannot be applied to a bit field, and no pointer can point to a bit field of a class
+
+## Bit field usage
+
+Bit fields usually use struct declarations, which set the name of each bit field member and determine its width:
+
+```
+struct bit_field_name
+{
+ type member_name : width;
+};
+```
+
+
+
+| Elements | Description |
+| -------------- | ------------------------------------------------------------ |
+| bit_field_name | Bit field structure name |
+| type | must be int、signed int or unsigned int type |
+| member_name | |
+| width | |
+
+For example, declare the following bit field:
+
+```
+struct _PRCODE
+{
+ unsigned int code1: 2;
+ unsigned int cdde2: 2;
+ unsigned int code3: 8;
+};
+struct _PRCODE prcode;
+```
+
+This definition makes' prcode 'contain two 2-bit fields and one 8-bit field. We can use the member operator of the structure to assign values to it
+
+```
+prcode.code1 = 0;
+prcode.code2 = 3;
+procde.code3 = 102;
+```
+
+When assigning a value, it should be noted that the size of the value should not exceed the capacity of the bit field member,For example prcode.code3 Is a bit domain member of 8 bits. Its capacity is 2^8 = 256,Assignment range should be [0,255]。
+
+## Size and alignment of bit fields
+
+### Size of bit field
+
+For example, the following bit field:
+
+```
+struct box
+{
+ unsigned int a: 1;
+ unsigned int : 3;
+ unsigned int b: 4;
+};
+```
+There is an unnamed bit field in the middle of the bit field structure, which occupies 3 bits and only plays a filling role and has no practical significance. The padding makes the structure use 8 bits in total. But C language uses unsigned int as the basic unit of bit field,Even if the only member of a structure is a bit field of 1 bit, the size of the structure is the same as that of an unsigned int.In some systems, the unsigned int is 16 bits, and in x86 systems it is 32 bits.For the following articles, the default value of unsigned int is 32 bits.
+
+### Alignment of bit fields
+
+A bit field member is not allowed to cross the boundary of two unsigned ints. If the total number of bits declared by a member exceeds the size of an unsigned int, the editor will automatically shift the bit field members to align them according to the boundary of the unsigned int
+
+For example:
+
+```
+struct stuff
+{
+ unsigned int field1: 30;
+ unsigned int field2: 4;
+ unsigned int field3: 3;
+};
+```
+
+
+
+`field1` + `field2` = 34 Bits,beyond 32 Bits, Complier`field2` move to the next unsigned int unit. stuff.field1 and stuff.field2 will leave the 2 Bits space, stuff.field3 follow closely stuff.field2.The structure is now of size 2 * 32 = 64 Bits。
+
+This hole can be filled with the unnamed bit field member mentioned earlier, or we can use an unnamed bit field member with a width of 0 to align the next field member with the next integer.
+For example:
+
+```
+struct stuff
+{
+ unsigned int field1: 30;
+ unsigned int : 2;
+ unsigned int field2: 4;
+ unsigned int : 0;
+ unsigned int field3: 3;
+};
+```
+
+
+
+Between stuff.field1 and stuff.field2 there is a 2 Bits space. Stuff.field3 will be stored in the next unsigned in. The size of this structure is 3 * 32 = 96 Bits。
+
+Code:[learn.cpp](learn.cpp)
+
+## Initialization of bit field and remapping of bit
+
+### Initialization
+
+
+The initialization method of bit field is the same as that of ordinary structure. Here, two methods are listed as follows:
+
+```
+struct stuff s1= {20,8,6};
+```
+
+Or directly assign values to the bit field members:
+
+```
+struct stuff s1;
+s1.field1 = 20;
+s1.field2 = 8;
+s1.field3 = 4;
+```
+
+### Re-mapping of bit field
+
+Declare a bit field with a size of 32 bits
+
+```
+struct box {
+ unsigned int ready: 2;
+ unsigned int error: 2;
+ unsigned int command: 4;
+ unsigned int sector_no: 24;
+}b1;
+```
+
+#### Zeroing bit field by remapping
+
+```
+int* p = (int *) &b1; // 将 "位域结构体的地址" 映射至 "整形(int*) 的地址"
+*p = 0; // clear s1, set all members to zero
+```
+
+#### The 32 bits bit field is remapped to the unsigned int type by union
+
+Let's briefly introduce the alliance
+
+> "Union" is a special class and a data structure of construction type.Many different data types can be defined in a "union". Any kind of data defined by the "union" can be loaded into a variable described as the "union" type. These data share the same memory to save space
+>
+> There are some similarities between "union" and "structure". But there are essential differences between them.In a structure, each member has its own memory space. The total length of a structure variable is the sum of the length of each member (except for empty structure, and boundary adjustment is not considered).In Union, members share a certain amount of memory space, and the length of a union variable is equal to the longest length of each member.It should be noted that the so-called sharing does not mean that multiple members are loaded into a joint variable at the same time, but that the joint variable can be assigned any member value, but only one value can be assigned at a time.
+
+We can declare the following Union:
+
+```
+union u_box {
+ struct box st_box;
+ unsigned int ui_box;
+};
+```
+
+
+
+In x86 system, unsigned int and box are 32 Bits, Through this combination, St_ Box and UI_ Box shares a piece of memory.Which bit in the specific bit field corresponds to which bit of the unsigned int depends on the compiler and hardware.Use union to return the bit field to zero. The code is as follows:
+
+```
+union u_box u;
+u.ui_box = 0;
+```
+
+> From:
diff --git a/english/basic_content/bit/learn.cpp b/english/basic_content/bit/learn.cpp
new file mode 100644
index 0000000..505256b
--- /dev/null
+++ b/english/basic_content/bit/learn.cpp
@@ -0,0 +1,19 @@
+#include
+
+using namespace std;
+struct stuff
+{
+ unsigned int field1: 30;
+ unsigned int : 2;
+ unsigned int field2: 4;
+ unsigned int : 0;
+ unsigned int field3: 3;
+};
+int main(){
+ struct stuff s={1,3,5};
+ cout<vec;
+typedef decltype(vec.begin()) vectype;
+for (vectype i = vec.begin; i != vec.end(); i++)
+{
+//...
+}
+```
+
+这样和auto一样,也提高了代码的可读性。
+
+### 1.3 重用匿名类型
+
+在C++中,我们有时候会遇上一些匿名类型,如:
+
+```c++
+struct
+{
+ int d ;
+ doubel b;
+}anon_s;
+```
+
+而借助decltype,我们可以重新使用这个匿名的结构体:
+
+```c++
+decltype(anon_s) as ;//定义了一个上面匿名的结构体
+```
+
+### 1.4 泛型编程中结合auto,用于追踪函数的返回值类型
+
+这也是decltype最大的用途了。
+
+```c++
+template
+auto multiply(T x, T y)->decltype(x*y)
+{
+ return x*y;
+}
+```
+
+完整代码见:[decltype.cpp](decltype.cpp)
+
+## 2.判别规则
+
+对于decltype(e)而言,其判别结果受以下条件的影响:
+
+如果e是一个没有带括号的标记符表达式或者类成员访问表达式,那么的decltype(e)就是e所命名的实体的类型。此外,如果e是一个被重载的函数,则会导致编译错误。
+否则 ,假设e的类型是T,如果e是一个将亡值,那么decltype(e)为T&&
+否则,假设e的类型是T,如果e是一个左值,那么decltype(e)为T&。
+否则,假设e的类型是T,则decltype(e)为T。
+
+标记符指的是除去关键字、字面量等编译器需要使用的标记之外的程序员自己定义的标记,而单个标记符对应的表达式即为标记符表达式。例如:
+```c++
+int arr[4]
+```
+则arr为一个标记符表达式,而arr[3]+0不是。
+
+举例如下:
+
+```c++
+int i = 4;
+int arr[5] = { 0 };
+int *ptr = arr;
+struct S{ double d; }s ;
+void Overloaded(int);
+void Overloaded(char);//重载的函数
+int && RvalRef();
+const bool Func(int);
+
+//规则一:推导为其类型
+decltype (arr) var1; //int 标记符表达式
+
+decltype (ptr) var2;//int * 标记符表达式
+
+decltype(s.d) var3;//doubel 成员访问表达式
+
+//decltype(Overloaded) var4;//重载函数。编译错误。
+
+//规则二:将亡值。推导为类型的右值引用。
+
+decltype (RvalRef()) var5 = 1;
+
+//规则三:左值,推导为类型的引用。
+
+decltype ((i))var6 = i; //int&
+
+decltype (true ? i : i) var7 = i; //int& 条件表达式返回左值。
+
+decltype (++i) var8 = i; //int& ++i返回i的左值。
+
+decltype(arr[5]) var9 = i;//int&. []操作返回左值
+
+decltype(*ptr)var10 = i;//int& *操作返回左值
+
+decltype("hello")var11 = "hello"; //const char(&)[9] 字符串字面常量为左值,且为const左值。
+
+
+//规则四:以上都不是,则推导为本类型
+
+decltype(1) var12;//const int
+
+decltype(Func(1)) var13=true;//const bool
+
+decltype(i++) var14 = i;//int i++返回右值
+```
+
+学习参考:https://www.cnblogs.com/QG-whz/p/4952980.html
diff --git a/english/basic_content/decltype/decltype b/english/basic_content/decltype/decltype
new file mode 100755
index 0000000000000000000000000000000000000000..fb9f578a277115e8c34da59ea4f0120b5dd4f17e
GIT binary patch
literal 22080
zcmeHPe{@vUoqw4m{3Z;DN`dNV!6JomCIk%1>V)LMM3b222c-%=CNmS5I+;n6HxO8<
zXsC4zv{~BqU~6}2*DBrPR%|^kbv^t(hHl*&t#$2IU5jsDtL
zZ<{LsjPL*ftxo*UL6W7?{7W-J*Gn!JC}2QbDEKtDr=Y6$Y1AV-FSNK>u!Y+z=9f8a
zzk=Mnc3nKyv7+j_cw}ijmPqw2?WA2OaeF&@)q;rycNZ62fxiHEkcu
zYn-11ll~zdd(BArQ=g(3T%j4p=B{MI=ruzMm)C*!?(^O}~{
zWUHZ*1$})+ceJNBnFz&W=5}MN4^okMGYPkvRnbHwULS5X{r>QlP>*5ugkolIeOT99
zKwAdwv9OWsHG86=uKG5k&1dMXE6@{E^^m?Z7nyNZw*UJ!^xD1E7`#qxq5RrZ1j?+{hHC9*cMAf;NIR;SCp7xH3aZ}
z_%0*7$+MUtMcd
zdaJCfO7C*5cK!OA)%AwoyG)YTuZM6I0zf7z7htK#EQFUL*AT^p93r7wJ4%pQ;)pRd
z|C_JbK9w@fk3pkS0{JxaeZXhOV$&&e{gi2`xv|Nl{|%cwU6MX3KYj8pG*zyRu)KNg
zJ}eC`?R}OXyKa+^quj