From 5e33459d8b976090357d232a43493a3e14b4f0db Mon Sep 17 00:00:00 2001 From: light-city <455954986@qq.com> Date: Fri, 26 Jul 2019 20:32:06 +0800 Subject: [PATCH] update dir --- README.md | 1 + struct/ext | Bin 9616 -> 14536 bytes struct/ext_struct_func.cpp | 7 +- struct_class/README.md | 223 ++---------------------------- struct_class/ext | Bin 9616 -> 0 bytes struct_class/ext_struct_func.cpp | 28 ---- struct_class/sf | Bin 8992 -> 0 bytes struct_class/stff | Bin 9152 -> 0 bytes struct_class/struct_func | Bin 8768 -> 0 bytes struct_class/struct_func.c | 27 ---- struct_class/struct_func.cpp | 25 ---- struct_class/struct_func_func.cpp | 39 ------ struct_class/stu | Bin 9112 -> 0 bytes 13 files changed, 17 insertions(+), 333 deletions(-) delete mode 100755 struct_class/ext delete mode 100644 struct_class/ext_struct_func.cpp delete mode 100755 struct_class/sf delete mode 100755 struct_class/stff delete mode 100755 struct_class/struct_func delete mode 100644 struct_class/struct_func.c delete mode 100644 struct_class/struct_func.cpp delete mode 100644 struct_class/struct_func_func.cpp delete mode 100755 struct_class/stu diff --git a/README.md b/README.md index 60a8827..67357dd 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ - [x] [位域那些事](./bit) - [x] [extern那些事](./extern) - [x] [struct那些事](./struct) +- [x] [struct与class那些事](./struct_class) 代码运行: 全部在linux下用vim编写,使用gcc/g++调试!全部可正常运行! diff --git a/struct/ext b/struct/ext index d450b9f8ebe93e7a673deaa6071f30abb5bdd080..45104f89893cae70439235bf4bab081661c77884 100755 GIT binary patch literal 14536 zcmeHO4QyN2b-pAeTmGXc*GW{niD=hJl?J9MTbAWEKcxOlI=?t|= z%zfv+d&tKpaxFSwKmlEd@7(iy&pr3P``)|v=nI|QU3QyIaIuSf1!426e3E2bg?Pm) zQAKMNtAtOu#jRomDAoA+B!{3;W4NeHGptc^4!|n>TI~j*)$WrOhMzFVf+2fIklHI2 zpQ;-06YC9>p@5fENRNEY-AWk2ff9I5`SAofC5u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base { virtual void print(){ printf("%s\n","Base"); }; + Base(){cout<<"Base construct"<print(); + delete b; return 0; } diff --git a/struct_class/README.md b/struct_class/README.md index c8d304d..119e039 100644 --- a/struct_class/README.md +++ b/struct_class/README.md @@ -1,222 +1,19 @@ -# 一文搞懂C和C++中struct +# struct与class区别 -## 1.C中struct +## 关于作者: -- 在C中struct只单纯的用作数据的复合类型,也就是说,在结构体声明中只能将数据成员放在里面,而不能将函数放在里面。 -- 在C结构体声明中不能使用C++访问修饰符,如:public、protected、private 而在C++中可以使用。 -- 在C中定义结构体变量,如果使用了下面定义必须加struct。 -- C的结构体不能继承(没有这一概念)。 -- 若结构体的名字与函数名相同,可以正常运行且正常的调用!例如:可以定义与 struct Base 不冲突的 void Base() {}。 +个人公众号: -完整案例: +![](../img/wechat.jpg) -```c -#include +关于C与C++中struct内容:见[struct那些事](../struct) -struct Base { // public - int v1; -// public: //error - int v2; - //private: - int v3; - //void print(){ // c中不能在结构体中嵌入函数 - // printf("%s\n","hello world"); - //}; //error! -}; +总的来说,struct 更适合看成是一个数据结构的实现体,class 更适合看成是一个对象的实现体。 -void Base(){ - printf("%s\n","I am Base func"); -} -//struct Base base1; //ok -//Base base2; //error -int main() { - struct Base base; - base.v1=1; - //base.print(); - printf("%d\n",base.v1); - Base(); - return 0; -} -``` +区别: -最后输出: +最本质的一个区别就是默认的访问控制 -``` -1 -I am Base func -``` +默认的继承访问权限。struct 是 public 的,class 是 private 的。 -完整代码见:[struct_func.c](./struct_func.c) - -## 2.C++中struct - -与C对比如下: - -- C++结构体中不仅可以定义数据,还可以定义函数。 -- C++结构体中可以使用访问修饰符,如:public、protected、private 。 -- C++结构体使用可以直接使用不带struct。 -- C++继承 -- 若结构体的名字与函数名相同,可以正常运行且正常的调用!但是定义结构体变量时候只用用带struct的! - -例如: - -> 情形1:不适用typedef定义结构体别名 - -未添加同名函数前: - -```c++ -struct Student { - -}; -Student(){} -Struct Student s; //ok -Srudent s; //ok -``` - -添加同名函数后: - -```c++ -struct Student { - -}; -Student(){} -Struct Student s; //ok -Srudent s; //error -``` - -> 情形二:使用typedef定义结构体别名 - -```c++ -typedef struct Base1 { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - void print(){ - printf("%s\n","hello world"); - }; -}B; -//void B() {} //error! 符号 "B" 已经被定义为一个 "struct Base1" 的别名 -``` - -> 前三种案例 - -```c++ -#include -#include - -struct Base { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - void print(){ - printf("%s\n","hello world"); - }; -}; - -int main() { - struct Base base1; //ok - Base base2; //ok - Base base; - base.v1=1; - base.v3=2; - base.print(); - printf("%d\n",base.v1); - printf("%d\n",base.v3); - return 0; -} -``` - -完整代码见:[struct_func.cpp](struct_func.cpp) - -> 继承案例 - -```c++ -#include -#include -struct Base { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - virtual void print(){ - printf("%s\n","Base"); - }; -}; -struct Derived:Base { - - public: - int v2; - void print(){ - printf("%s\n","Derived"); - }; -}; -int main() { - Base *b=new Derived(); - b->print(); - return 0; -} -``` - -完整代码见:[ext_struct_func.cpp](./ext_struct_func.cpp) - -> 同名函数 - -```c++ -#include -#include - -struct Base { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - void print(){ - printf("%s\n","hello world"); - }; -}; - -typedef struct Base1 { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - void print(){ - printf("%s\n","hello world"); - }; -}B; -void Base(){ - printf("%s\n","I am Base func"); -} -//void B() {} //error! 符号 "B" 已经被定义为一个 "struct Base1" 的别名 -int main() { - struct Base base; //ok - //Base base1; // error! - base.v1=1; - base.v3=2; - base.print(); - printf("%d\n",base.v1); - printf("%d\n",base.v3); - Base(); - return 0; -} -``` -完整代码见:[struct_func_func.cpp](./struct_func_func.cpp) - -## 3.总结 - -### C和C++中的Struct区别 - -| C | C++ | -| ------------------------------------------------------ | ------------------------------------------------------------ | -| 不能将函数放在结构体声明 | 能将函数放在结构体声明 | -| 在C结构体声明中不能使用C++访问修饰符。 | public、protected、private 在C++中可以使用。 | -| 在C中定义结构体变量,如果使用了下面定义必须加struct。 | 可以不加struct | -| 结构体不能继承(没有这一概念)。 | 可以继承 | -| 若结构体的名字与函数名相同,可以正常运行且正常的调用! | 若结构体的名字与函数名相同,使用结构体,只能使用带struct定义! | \ No newline at end of file +struct 作为数据结构的实现体,它默认的数据访问控制是 public 的,而 class 作为对象的实现体,它默认的成员变量访问控制是 private 的。 diff --git a/struct_class/ext b/struct_class/ext deleted file mode 100755 index d450b9f8ebe93e7a673deaa6071f30abb5bdd080..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9616 zcmeHNeQ;b=6~Ea{nr&LP+wx&((Jt8159pGlX-HwDZ}ZW$_#&m%7@*j8|MI}wbILR36iSHH3?b2LQH;CiVCY23xy_D zifhCIAZ2(oSwq|^G0!U3%sooa4PJ_;-em#xE=?AgUt_^&!6J^3IJK82O%*Nv&|*tu zE`(nKWJj@PFOwp8w=6L4R&i8PV3PdumteB1^hy!DTNap4slb?X|EO>Dgp}WqOM^tR zMocux-#jN>qFt|=5i0jrND*9<1?CY87R=f1ldz*WKP>r_V!LW@zH#xW_?fHjikk*v zJ$1D=4Ma8!#Nz4U4a4$K#}(0Q^o6@-&`e{$s$e70X4ZuNx&HI_0kr z-vKB5gadyBxb&mmYo#s(<}qbPdT+Ra=B`c{#{R)X+(?<>q-hw!*nYrhkM579%xJQ4 zAe>4?Q^IHo?Jy$Iq=G{`8V3^bXeit>5Vh)x*X#}LX{)X>jNakla8K+&b@k0ClS{)q zI21Kv@xDZ}F!r`}nDwzl%IFEFqO~pYnAud_d;qw^x(1$7u@B{-(Q**KdyqQYYxQ#| zZK5X#CTxVw=y1%0K((spgW*_QGoZ3X(Ff1KJz;9ia+d2ZS#oKvAVyALWp9TOP`O8_s(RnXI+p&hJXl5p*+(0r-&CD4o-$F8VdFF(aYe=T9&O9#V^(0dlXGW!b z-s2a2qmU(4ztxg?Zl9j{qdxM=g_AO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ki}Pv zVQ;8Kq0ZRmN!b^M$0H)w4?HMeQ5pgC9ZCGc;TM6_!9g?J18ycQ-p?hBc{DjB0`Y_y z4Iq=h!3^(L(*Afl(36hg&sVXC2$0ktPW6jG5I(t3m8RYG?e<7@bS8<>t;M^)3xk{_nJWPnRHmNY_puhft0OpGQf2 zFXO+1`W4QMzt=2RqhPn^`f)UdKBGAP;Y`JQ}2*$?G3t%6U<%)jEW z_m^u@!%vG6#PM3vT=_9n*xTpxe3i2Q1`n)q!0ocXZ#wKbpZ2^u0P;DI^_~5HLfLaO zd@i0+hDX^@ac6&i=&y!iwm;^u=e)pVg=P2?$AWjZ{|wY{Yt7~7_#Vdp zKEXL&PWu;NyToSCc?J(T1v&Md^2^Yn5a}Hz;`_YsL)yOv8(L~?&-pd}_ajrP|7tnr z;^BTBhpoMR&TnL?Qy^!&EHnQzbnN!IJcw#QmtOKeY{xw7u;+WNuIxEZ_P};5UqXQ} z?mwUNJC)%{R#e<+??&(xf0aXz?Ke4a(j{WP6lHE(R;Zsd>cd5U -#include - -struct Base { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - virtual void print(){ - printf("%s\n","Base"); - }; -}; - -struct Derived:Base { - - public: - int v2; - void print(){ - printf("%s\n","Derived"); - }; -}; - -int main() { - Base *b=new Derived(); - b->print(); - return 0; -} diff --git a/struct_class/sf b/struct_class/sf deleted file mode 100755 index 321061d21e6b74b8b0d849adf04d1b76e15d119f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8992 zcmeHMeQaA-6~DIg;jW$It}X4_X|-V8+D&;&x-_H=wbFO}PLX|k1#^x3hU#^BhM z{an(DL8o-ptbIi=K@lKT45T65^sNg@|sDq~djnWkMGl z#ciSqoJL%_ln}OCj2D$_#(t&e18%_8<+T}IUR^dA-)6JXgAE)ZVd}2}x@y|^=gVx8 zu@E82AUle6@n%T^M`eTYeicVlVYVZZ?A8UOI&f4r7++L@G3N2n*ytKk{)W6dD57;j zqF3H4m~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z&z0k$m;d#?BR$tl3C@239-9SV{A=R7g^G3_tGmL4_RbG?KA z&%da~ua-kO9v;_8SO1)MF4CX??s%DI{4eM@<1go@sso*zIDqXKFGA+D=R8(d_8cd> zU^}L-qd`0#Kj*u9m7!Z-O$VC`$_I$oR_53Zw%_LBvpr+VAGmL)>VP^p=syl8xJcP| ndG9zBpHlHJs0VjDWLt6Zc<3x6p#52||4CKQ`;*JLyZ`?HS_2Ph diff --git a/struct_class/stff b/struct_class/stff deleted file mode 100755 index de4372784a1ac8ea9c10b399a4f029d1afecc810..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9152 zcmeHNeQaA-6~DHVG+j5x-8z=FW3@&r+KqTln}&>u?m3Cumyx!iaknv+y*jp&m^pT2 zKX*w*N2_c_rt1i7piY25j7#m7WK@4o`>M0y^B9Ofcu-m~#z@Q+Z|5RMO&?t*}JqLii;> zc2w8J3#16XS0MY#Qo@pM0H+;hvop~zw`KwuiyT))Mp=m z`Pm15{)vb0z4y7F^^-mgC6AjB@CZQ-uhY>z z&6z&8X2eErGlrtclo-n<)8-KH*m%^4 znu+nG34yFs?O~&Rxo0T>;*;1PVTc{_jDeT64bE|ZnoO_h#l7Dh` z$^JGsei=*HBmPX8AQvp|2j}&&Dw)I%QYT(fSblX9E7dLDB4yBG(_YDGEvls>Em-~f& z*Nj;|e?)?(8fPt~;+EeatGNC-yqnf)NRd23nG178(E4AIOif&PM#{e+nYv^gp?m9nVP=vEh&GGWNPxll$5_sGBtJKpp-iy4^2Uq)cRUa;n`dD!i)OknX`S7 zp3^h_<(kk>pFGh>?DXknnwbAQ4F56Iw6^h1A_4o;r)z=2*ktDl^|PIo=2KYPx+xa4gGduv)N z24=1D4}N^1(Jw@PY`&_X&H84v6hRz??kJPQ-K&>f+7h7jehv#S{PKVFX0O&`kF|C`J~?g{ez_I^=9aN5~rtc{g-={m_Gcr?*k|>qpSP&1k26zb2Rer~miB|7s6R;k!t52R@TTV@j3+ zURV;6oSe==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zdnW&$?d&h7{qwMGvf1-}w2_>Gocd1rFVLYXa`}93^}SE~zrmJUzVA_4jp^_OZR0}K%ewdez6_%MTb4#fBKX?*ONW49n0sC zAdK73=ij}`(5bJwgUy8p0AaxrVkOvqivwqS=5%l2vhAv`sg2`&R#ce|QI^ef-)?_Q h)xU#2PN2*2Y{J9s;r)-Md9CuFQ31yfIx?N*{}aP|l5_w7 diff --git a/struct_class/struct_func b/struct_class/struct_func deleted file mode 100755 index 8541eba04debc9e9e2a892f8ac02d5ba9654f50c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8768 zcmeHMeQaA-6~DIg)i1~G(k*SL)pU)NP0Fj&C0V)+_Uy#%bLFI2>I{vMzBv9!-1;N3 zpS!dY5J*?a>NP=yMbgg`?=sQUv5LL#YBwW@?fCawIl3Bt6YWFL?+D3RD|&bjX% z`}xL!35kDDkM-WU=XcLJ_uTXDeed4uulR$9?KT@Dva`=Il$L5#4w-kxrgn2tVBKsJ zQ`uhjAgcqU7A}?7AU8|I*Mw{04MNWWyaujry9spLRbC+epb0|@CQ*dQvAr^>qG<9C z(ExGA+`Jy`Fjkk7i@-;CfjGsXig?HlMYL-bcCEsW_@W4mIQ0+vhF3`V3)xkWP*#z# zUVblg)I}P2*N9^I9c+|ywSqszCB}%8-7{b(OoYb2XD(4aDB9a7FRP+|#D&NXBom`u z9S4%pwqzompKP1#?rQ7mP;wdNAn!N&N8Ka+L%b!*qZ=fQxd|>D16cpY<=bcdWAT~b zh5m2+zOU>4j&Dc)fwpu(@l(?l(A-f)8{?^le`W)`bp!kfz};}IBgjVtyWhno@((PU(^HQ+hm{NV17+B5lM0M@6j68hR?6NCPsK%A^INvm?QPuSY+qbd*X5l}>EU z4*9af&mwR<3Y)AIR|;kU6z~7%04cLMyzjO~11`5DMIw zpRZGycH`;*XE%OVtFq-^fZ^ZbjeC0;n>_{{8PeJ`VA}MWQ!BiCde1Dn!tl2b&tXMz z36#%q|HBIybzC9&*H}NKef7`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~zK|?|rV{+ZX5oElUkQjsyr!V|BkKylK6IOg|Dl=JN*iV}}nP_lNY5*BA6- z3;Yl>lFRdMFg+0J)5{48_4QzSLgCS5jGu<8DxGTLS*9L~hK(>dsXQSqD|Lv&(lWx$ zqnBw&X+Klj+kjBz^Wi+3Fv-U)kDJYGHbK^{jo=Jm0lN(vH=5#EZOJvd&f(~`r zSTc+TqBM~-n8N$3Kv5aXfM~=f;f~`HlrsDoDY0=e633(9ge23{9FnF5l}|=M4Vnq3 z5)p_YW1xFL@PR9kSf;?_NWp-Yrtg0(;&&CMa%ufe>qYuMhxQfJ0P0%lVG!!!g4YBm zT36ElHg16vqxT}o?NG4V)B4j84)>Fy;Ie%$;CEo{Pwii_t6cMv04V-ij+XaFLS+3= zz`YLH(|UGR0CW&u2Rhhyd7ttuV7M0|ds_EuVuM8cDNx}g=kEldxR)V&S|7hE>}j7! z@sl3$Q(%vKBa&$yJuB?-j2cOf-$WV1br0s0>}kEdEbL)r$cfsQ`+p8<(cWjOfuNct z1c65Q-Q0hoFWLTOz%VBmAJT}h9})Jn&oyh!wy2D}0GHK%O4v^cdwy1IF>r}8@o!1? zv>#X$_7pF20xMCwg#7>t*7#|EaZMzI_Q9kt+>*$CEbQs|(fVUi z*f*6l&4O(Inq*J=75e}5ssCU4`?Nn> z!%hLo@sdpZFQ8+MzqF4N4Rmuat+PWJq-TT30;6W - -struct Base { // public - int v1; -// public: //error - int v2; - //private: - int v3; - //void print(){ // c中不能在结构体中嵌入函数 - // printf("%s\n","hello world"); - //}; //error! -}; - -void Base(){ - printf("%s\n","I am Base func"); -} -//struct Base base1; //ok -//Base base2; //error - -int main() { - struct Base base; - base.v1=1; - //base.print(); - printf("%d\n",base.v1); - Base(); - return 0; -} diff --git a/struct_class/struct_func.cpp b/struct_class/struct_func.cpp deleted file mode 100644 index 09bef26..0000000 --- a/struct_class/struct_func.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -struct Base { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - void print(){ - printf("%s\n","hello world"); - }; -}; - -int main() { - struct Base base1; //ok - Base base2; //ok - Base base; - base.v1=1; - base.v3=2; - base.print(); - printf("%d\n",base.v1); - printf("%d\n",base.v3); - return 0; -} diff --git a/struct_class/struct_func_func.cpp b/struct_class/struct_func_func.cpp deleted file mode 100644 index bce3749..0000000 --- a/struct_class/struct_func_func.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include - -struct Base { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - void print(){ - printf("%s\n","hello world"); - }; -}; - -typedef struct Base1 { - int v1; -// private: //error! - int v3; - public: //显示声明public - int v2; - void print(){ - printf("%s\n","hello world"); - }; -}B; -void Base(){ - printf("%s\n","I am Base func"); -} -//void B() {} //error! 符号 "B" 已经被定义为一个 "struct Base1" 的别名 -int main() { - struct Base base; //ok - //Base base1; // error! - base.v1=1; - base.v3=2; - base.print(); - printf("%d\n",base.v1); - printf("%d\n",base.v3); - Base(); - return 0; -} diff --git a/struct_class/stu b/struct_class/stu deleted file mode 100755 index 6dabbe152c2f4faf6d091db222b375f2d752acfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9112 zcmeHNeQaCR6~DIg;kMwokV0t@wOG5gpcto3vM@IKoW$u%m!?^oK*tELj_o8Kjvd+0 zC9Nn+m(s~<%c2djPTB_=+r-$Ub(^*^gh;v|A|_2L6KvDQv<$(N@G;7ODw;~O-?{G| zf4n$=G--cvqW8`{zkANP=iYbkeeWLUOQFtor^6wboZ?nN(sY$3A?q&0pEpWTVa;Nd z(8MNjt*8Q0iA$3;#H|wZMdg~gTj{yLD{wVCEuh({$pZ6hEf_6W#1Rsw_6nq_qQ#$I zZHdf<@JWE|DAvWxr3ijN7MKsKI7Ss`I}*umy+^8pACLv+b1E?A+&}6YUA@X*uTz6W zvPMj_$$Np5E>ZU@W|YbetE337$pZ6E3l_}T?sKrCI6o|Tm12)-Z>4c@tN59#?uwfd z@qwm>n-b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