C++????explicit??????
???????????? ???????[ 2014/7/8 10:32:38 ] ????????C++ net
???????????漲????????????????????????????????????????ù???????????????????????????????????????????
????class String {
????String ( const char* p ); // ??C?????????p?????????
????//…
????}
????String s1 = “hello”; //OK ?????????????String s1 = String??“hello”??;
?????????е??????????????????????????£?
????class String {
????String ( int n ); //????????????n???????????
????String ( const char* p ); // ??C?????????p?????????
????//…
????}
????????????д???????????
????String s2 ( 10 ); //OK ????10????????????
????String s3 = String ( 10 ); //OK ????10????????????
????????????д???????????
????String s4 = 10; //???????????????10????????????
????String s5 = ‘a’; //?????????????int??‘a’??????????????
????s4 ??s5 ???????int???char??????????????????????????????????????????
???????????????????????????????????????????????explicit ??????
????class String {
????explicit String ( int n ); //????????????n???????????
????String ( const char* p ); // ??C?????????p?????????
????//…
????}
????????explicit????????String ( int n )??????????
????????????д??????????
????String s2 ( 10 ); //OK ????10????????????
????String s3 = String ( 10 ); //OK ????10????????????
????????????д???????????
????String s4 = 10; //???????????????????????
????String s5 = ‘a’; //???????????????????????
?????????Щ???explicit ??????Ч?÷???????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11