<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Oo緣來是你oO


    posts - 120,comments - 125,trackbacks - 0
    Item 1:View C++ as a federation of languages
    ?
    Item 1:將C++視為語言的聯(lián)合體
    ?
    ------------------- Chinese -------------------
    ?
    最初,C++僅僅是在C的基礎(chǔ)上附加了一些面向?qū)ο蟮奶卣鳌5牵S著C++的成長(zhǎng)發(fā)展,C++已經(jīng)成為了一個(gè)多范式的編程語言,一個(gè)囊括了過程化,面向?qū)ο螅瘮?shù)化,泛型以及元編程特性的聯(lián)合體。可以將它分成4個(gè)部分:
    ?
    C ------ 歸根結(jié)底,C++依然是基于C的。模塊,語句,預(yù)處理器,內(nèi)建數(shù)據(jù)類型,數(shù)組,指針等,全都來自于C。只是在很多方面,C++提出了更高級(jí)的解決問題的方法。
    ?
    Object-Oriented C++ ------ C++的這部分就是C with Classes 涉及到的全部:類(包括構(gòu)造函數(shù)和析構(gòu)函數(shù)),封裝,繼承,多態(tài),虛函數(shù)(動(dòng)態(tài)邦定)等。C++的這一部分直接適用于面向?qū)ο笤O(shè)計(jì)的經(jīng)典規(guī)則。
    ?
    Template C++ ------ 這是C++的泛型編程部分。
    ?
    STL ------ STL是一個(gè)特殊的模板庫。它將容器,迭代器,算法和函數(shù)對(duì)象優(yōu)雅的整合在一起。
    ?????
    頭腦中保持這四個(gè)子語言,從一種子語言轉(zhuǎn)到另一種時(shí),為了高效編程,需要改變策略:
    ?
    ????? 例如,適用內(nèi)建(類C的)類型時(shí),傳值通常比傳引用更高效,但是當(dāng)從C++的C部分轉(zhuǎn)到C++的Object-Oriented部分,用戶自定義構(gòu)造函數(shù)和析構(gòu)函數(shù)意味著更好的做法是將引用傳遞給const參數(shù)。在 Template C++ 中工作時(shí),這一點(diǎn)更加重要,因?yàn)椋谶@種情況下,你甚至不知道你的操作涉及到的對(duì)象的類型。當(dāng)你進(jìn)入 STL,無論如何,你知道迭代器和函數(shù)對(duì)象以 C 的指針為原型,對(duì)于 STL 中的迭代器和函數(shù)對(duì)象,古老的 C 中的傳值規(guī)則又重新生效。
    ?
    ***********************************************************
    ?
    Things to Remember:
    ?
    ????? 高效C++編程規(guī)則的變化,依賴于你使用C++的哪一個(gè)部分。
    ?
    ?
    ?
    ?
    ?
    ------------------- English --------------------
    ?
    In the beginning, C++ was just C with some object-oriented features tacked on. As the language matured, C++?have become a multiparadigm programming language, one suppoting a combination of procedural, object-oriented, functional, generic, and metaprogramming features.
    ?
    There are four parts in the C++:
    ?
    C ------ Way down deep, C++ is still based on C. Blocks, statements, the preprocessor, built-in data types, arrays, pointers,etc, all come from C. In many cases, C++ just offers approaches to problems that are superior to their C counterparts.
    ?
    Object-Oriented C++ ------ This part of C++ is what C with Classes was all about: classes(including constructors and destructors), encapsulation, inheritance, polymorphism, virtual functions(dynamic binding),etc. This is the part of C++ to which the classic rules for object-oriented design most directly apply.
    ?
    Template C++ ------ This is the generic programming part of C++.
    ?
    The STL ------ The STL si avery special template library. Its conventions regarding containers, iterators, algorithms, and function objects mesh beautifully.
    ?
    Keep these four sublanguages in mind, and don't be surprised when you encounter situations where effective programming requires that you change strategy when you switch from one sublanguage to another.
    ?
    For example, pass-by-value is generally more efficient than pass-by-reference for built-in (i.e., C-like) types, but when you move from the C part of C++ to Object-Oriented C++, the existence of user-defined constructors and destructors means that pass-by-reference-to-const is usually better. This is especially the case when working in Template C++, because there, you don't even know the type of object you're dealing with. When you cross into the STL, however, you know that iterators and function objects are modeled on pointers in C, so for iterators and function objects in the STL, the old C pass-by-value rule applies again.??
    ?
    **********************************************************
    ?
    Things to Remember
    ?
    Rules for effective C++ programming vary, depending on the part of C++ you are using!


    馬嘉楠
    jianan.ma@gmail.com

    posted on 2006-08-21 12:56 馬嘉楠 閱讀(346) 評(píng)論(0)  編輯  收藏 所屬分類: 經(jīng)典 C++

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲国产精品成人一区| 日本高清免费aaaaa大片视频| 亚洲日韩国产精品乱| 色婷婷综合缴情综免费观看| 国产成人涩涩涩视频在线观看免费 | 最近2019中文字幕免费大全5| 亚洲av无码国产精品色午夜字幕| 久久一区二区免费播放| 亚洲av永久无码精品秋霞电影影院| a级在线观看免费| 人人狠狠综合久久亚洲88| 无码专区AAAAAA免费视频| 亚洲成aⅴ人片在线观| 国产精品成人免费一区二区 | 精品国产污污免费网站aⅴ| 91亚洲国产成人精品下载| 黄色免费网站网址| 亚洲天然素人无码专区| 免费国产成人午夜电影| 国产免费内射又粗又爽密桃视频| 久久亚洲精品成人| 国产v精品成人免费视频400条| 亚洲欧洲专线一区| 亚洲国产香蕉人人爽成AV片久久 | 国产hs免费高清在线观看| 精品国产免费人成网站| 亚洲视频免费在线观看| 免费看韩国黄a片在线观看| 国产精品亚洲天堂| 亚洲AV无码久久精品成人| 人与禽交免费网站视频| 亚洲av乱码中文一区二区三区| 亚洲男人av香蕉爽爽爽爽| 日韩精品无码免费一区二区三区 | 国产偷国产偷亚洲清高APP| 亚洲色中文字幕无码AV| 18国产精品白浆在线观看免费| 国产精品亚洲一区二区无码| 日本亚洲欧洲免费天堂午夜看片女人员| 最近2019免费中文字幕视频三| 水蜜桃视频在线观看免费|