關(guān)于我們
書(shū)單推薦
新書(shū)推薦
|
C語(yǔ)言大學(xué)教程(第八版)(英文版) 讀者對(duì)象:本書(shū)不僅適合于初學(xué)者學(xué)習(xí),作為高校計(jì)算機(jī)程序設(shè)計(jì)教學(xué)的雙語(yǔ)教材,也同樣適用于有經(jīng)驗(yàn)的程序員,作為軟件開(kāi)發(fā)人員的專業(yè)參考書(shū)。
本書(shū)是全球優(yōu)秀的C語(yǔ)言教程之一。全書(shū)系統(tǒng)地介紹了4種當(dāng)今流行的程序設(shè)計(jì)方法——面向過(guò)程、基于對(duì)象、面向?qū)ο笠约胺盒途幊,?nèi)容全面、生動(dòng)、易懂,作者由淺入深地介紹了結(jié)構(gòu)化編程及軟件工程的基本概念,從簡(jiǎn)單概念到最終完整的語(yǔ)言描述,清晰、準(zhǔn)確、透徹、詳細(xì)地講解了C語(yǔ)言,尤其注重程序設(shè)計(jì)思想和方法的介紹。相比上一版,這一版在內(nèi)容方面新增加了安全的C程序設(shè)計(jì)、提高練習(xí)題,更新了C++和面向?qū)ο蟪绦蛟O(shè)計(jì)、基于Allegro的游戲編程、C99標(biāo)準(zhǔn)介紹等內(nèi)容。
Paul Deitel,Deitel & Associates公司CEO兼CTO,具有超過(guò)35年計(jì)算機(jī)行業(yè)的工作經(jīng)驗(yàn),畢業(yè)于麻省理工學(xué)院。他擁有Java Certified Programmer和Java Certified Developer認(rèn)證證書(shū),并且被授予Oracle Java Champion稱號(hào)。通過(guò)Deitel & Associates公司,他向行業(yè)客戶提供了數(shù)以百計(jì)的編程課程,這些客戶包括:Cisco,IBM, Siemens,Sun Microsystems(現(xiàn)在屬于Oracle),Dell,F(xiàn)idelity,NASA肯尼迪航天中心,美國(guó)國(guó)家風(fēng)暴實(shí)驗(yàn)室,白沙導(dǎo)彈基地,Rogue Wave Software,Boeing,SunGard Higher Education,Nortel Networks,Puma,iRobot,Invensys,等等。他和合作者Harvey Deitel博士,是全球暢銷(xiāo)的編程語(yǔ)言教材和專業(yè)圖書(shū)/視頻產(chǎn)品的作者。Harvey Deitel博士,Deitel & Associates公司主席兼首席戰(zhàn)略官,具有55年以上的計(jì)算機(jī)行業(yè)工作經(jīng)驗(yàn)。Deitel博士在麻省理工學(xué)院獲得電子工程學(xué)士和碩士學(xué)位,在波士頓大學(xué)獲得數(shù)學(xué)博士學(xué)位——在將計(jì)算機(jī)科學(xué)專業(yè)從這些專業(yè)分離出去之前,Deitel博士已經(jīng)學(xué)習(xí)過(guò)計(jì)算機(jī)知識(shí)。他具有豐富的大學(xué)教學(xué)經(jīng)驗(yàn),在與兒子Paul于1991年創(chuàng)立Deitel & Associates公司之前,Deitel博士是波士頓大學(xué)計(jì)算機(jī)科學(xué)系主任并獲得了終身教職。他們的出版物已經(jīng)贏得了國(guó)際聲譽(yù),并被翻譯成了日文、德文、俄文、西班牙文、法文、波蘭文、意大利文、簡(jiǎn)體中文、繁體中文、韓文、葡萄牙文、希臘文、烏爾都文和土耳其文。Deitel博士為許多大公司、學(xué)術(shù)機(jī)構(gòu)、政府部門(mén)和軍隊(duì)提供了數(shù)百場(chǎng)的專業(yè)編程培訓(xùn)。
Paul Deitel,Deitel & Associates公司CEO兼CTO,具有超過(guò)35年計(jì)算機(jī)行業(yè)的工作經(jīng)驗(yàn),畢業(yè)于麻省理工學(xué)院。他擁有Java Certified Programmer和Java Certified Developer認(rèn)證證書(shū),并且被授予Oracle Java Champion稱號(hào)。通過(guò)Deitel & Associates公司,他向行業(yè)客戶提供了數(shù)以百計(jì)的編程課程,這些客戶包括:Cisco,IBM, Siemens,Sun Microsystems(現(xiàn)在屬于Oracle),Dell,F(xiàn)idelity,NASA肯尼迪航天中心,美國(guó)國(guó)家風(fēng)暴實(shí)驗(yàn)室,白沙導(dǎo)彈基地,Rogue Wave Software,Boeing,SunGard Higher Education,Nortel Networks,Puma,iRobot,Invensys,等等。他和合作者Harvey Deitel博士,是全球暢銷(xiāo)的編程語(yǔ)言教材和專業(yè)圖書(shū)/視頻產(chǎn)品的作者。Harvey Deitel博士,Deitel & Associates公司主席兼首席戰(zhàn)略官,具有55年以上的計(jì)算機(jī)行業(yè)工作經(jīng)驗(yàn)。Deitel博士在麻省理工學(xué)院獲得電子工程學(xué)士和碩士學(xué)位,在波士頓大學(xué)獲得數(shù)學(xué)博士學(xué)位——在將計(jì)算機(jī)科學(xué)專業(yè)從這些專業(yè)分離出去之前,Deitel博士已經(jīng)學(xué)習(xí)過(guò)計(jì)算機(jī)知識(shí)。他具有豐富的大學(xué)教學(xué)經(jīng)驗(yàn),在與兒子Paul于1991年創(chuàng)立Deitel & Associates公司之前,Deitel博士是波士頓大學(xué)計(jì)算機(jī)科學(xué)系主任并獲得了終身教職。他們的出版物已經(jīng)贏得了國(guó)際聲譽(yù),并被翻譯成了日文、德文、俄文、西班牙文、法文、波蘭文、意大利文、簡(jiǎn)體中文、繁體中文、韓文、葡萄牙文、希臘文、烏爾都文和土耳其文。Deitel博士為許多大公司、學(xué)術(shù)機(jī)構(gòu)、政府部門(mén)和軍隊(duì)提供了數(shù)百場(chǎng)的專業(yè)編程培訓(xùn)。
目?錄
1?Introduction to Computers, the Internet and the Web 計(jì)算機(jī)、因特網(wǎng)和萬(wàn)維網(wǎng)導(dǎo)論 33 1.1?Introduction 引言 34 1.2?Hardware and Software 計(jì)算機(jī)硬件和軟件 35 1.3?Data Hierarchy 數(shù)據(jù)的層次結(jié)構(gòu) 37 1.4?Machine Languages, Assembly Languages and High-Level Languages 機(jī)器語(yǔ)言、匯編語(yǔ)言和高級(jí)語(yǔ)言 40 1.5?The C Programming Language C程序設(shè)計(jì)語(yǔ)言 41 1.6?C Standard Library C標(biāo)準(zhǔn)庫(kù) 42 1.7?C++ and Other C-Based Languages? C++和其他基于C的程序設(shè)計(jì)語(yǔ)言 43 1.8?Object Technology 對(duì)象技術(shù) 44 1.9?Typical C Program-Development Environment 典型的C程序開(kāi)發(fā)環(huán)境 47 1.10?Test-Driving a C Application in Windows, Linux and Mac OS X 在Windows、Linux和Mac OS X上測(cè)試并運(yùn)行一個(gè)C應(yīng)用程序 49 1.11?Operating Systems 操作系統(tǒng) 59 1.12?The Internet and World Wide Web 因特網(wǎng)和萬(wàn)維網(wǎng) 61 1.13?Some Key Software Terminology 一些重要的軟件術(shù)語(yǔ) 64 1.14?Keeping Up-to-Date with Information Technologies 跟上信息技術(shù)的發(fā)展 66 2?Introduction to C Programming C程序設(shè)計(jì)入門(mén) 71 2.1?Introduction 引言 72 2.2?A Simple C Program: Printing a Line of Text 一個(gè)簡(jiǎn)單的C程序:打印一行文字 72 2.3?Another Simple C Program: Adding Two Integers 另一個(gè)簡(jiǎn)單的C程序:兩個(gè)整數(shù)求和 76 2.4?Memory Concepts 存儲(chǔ)單元的基本概念 80 2.5?Arithmetic in C C語(yǔ)言中的算術(shù)運(yùn)算 81 2.6?Decision Making: Equality and Relational Operators 做出決策:相等和關(guān)系運(yùn)算符 85 2.7?Secure C Programming 安全的C程序設(shè)計(jì) 89 3?Structured Program Development in C 結(jié)構(gòu)化的C程序設(shè)計(jì) 101 3.1?Introduction 引言 102 3.2?Algorithms 算法 102 3.3?Pseudocode 偽代碼 102 3.4?Control Structures 控制結(jié)構(gòu) 103 3.5?The if Selection Statement if條件語(yǔ)句 105 3.6?The if…else Selection Statement if…else條件語(yǔ)句 106 3.7?The while Iteration Statement while循環(huán)語(yǔ)句 110 3.8?Formulating Algorithms Case Study 1: Counter-Controlled Iteration 算法設(shè)計(jì)案例1:計(jì)數(shù)控制的循環(huán) 111 3.9?Formulating Algorithms with Top-Down, Stepwise Refinement Case Study 2: Sentinel-Controlled Iteration 自頂向下、逐步求精的算法設(shè)計(jì)案例2:標(biāo)記控制的循環(huán) 114 3.10?Formulating Algorithms with Top-Down, Stepwise Refinement Case Study 3: Nested Control Statements 自頂向下、逐步求精的算法設(shè)計(jì)案例3:嵌套控制結(jié)構(gòu) 120 3.11?Assignment Operators 賦值運(yùn)算符 124 3.12?Increment and Decrement Operators 增1和減1運(yùn)算符 125 3.13?Secure C Programming 安全的C程序設(shè)計(jì) 127 4?C Program Control C程序控制 145 4.1?Introduction 引言 146 4.2?Iteration Essentials 循環(huán)的基本原理 146 4.3?Counter-Controlled Iteration 計(jì)數(shù)控制的循環(huán) 147 4.4?for Iteration Statement for循環(huán)語(yǔ)句 148 4.5?for Statement: Notes and Observations for語(yǔ)句:注意事項(xiàng) 151 4.6?Examples Using the for Statement 使用 for語(yǔ)句的例子 152 4.7?switch Multiple-Selection Statement switch多重選擇語(yǔ)句 155 4.8?do…while Iteration Statement do…while循環(huán)語(yǔ)句 161 4.9?break and continue Statements break和continue語(yǔ)句 162 4.10?Logical Operators 邏輯運(yùn)算符 164 4.11?Confusing Equality (=?=) and Assignment (=) Operators 區(qū)分相等運(yùn)算符(=?=)和賦值運(yùn)算符(=) 167 4.12?Structured Programming Summary 結(jié)構(gòu)化程序設(shè)計(jì)小結(jié) 169 4.13?Secure C Programming 安全的C程序設(shè)計(jì) 174 5?C Functions C函數(shù) 189 5.1?Introduction 引言 190 5.2?Modularizing Programs in C C語(yǔ)言中的程序模塊 190 5.3?Math Library Functions 數(shù)學(xué)庫(kù)函數(shù) 191 5.4?Functions 函數(shù) 193 5.5?Function Definitions 函數(shù)定義 193 5.6?Function Prototypes: A Deeper Look 函數(shù)原型:深入學(xué)習(xí) 198 5.7?Function Call Stack and Stack Frames 函數(shù)調(diào)用堆棧及活動(dòng)記錄堆棧幀 200 5.8?Headers 頭文件 204 5.9?Passing Arguments By Value and By Reference 按值或按引用傳遞參數(shù) 205 5.10?Random Number Generation 隨機(jī)數(shù)的生成 206 5.11?Example: A Game of Chance; Introducing enum 案例分析:運(yùn)氣游戲;引入enum 210 5.12?Storage Classes 存儲(chǔ)類型 214 5.13?Scope Rules 作用域的規(guī)定 216 5.14?Recursion 遞歸 219 5.15?Example Using Recursion: Fibonacci Series 遞歸應(yīng)用案例:Fibonacci數(shù)列 222 5.16?Recursion vs. Iteration 遞歸與迭代 226 5.17?Secure C Programming 安全的C程序設(shè)計(jì) 227 6?C Arrays C數(shù)組 246 6.1?Introduction 引言 247 6.2?Arrays 數(shù)組 247 6.3?Defining Arrays 數(shù)組定義 249 6.4?Array Examples 數(shù)組實(shí)例 249 6.5?Using Character Arrays to Store and Manipulate Strings 用字符數(shù)組來(lái)存儲(chǔ)和處理字符串 257 6.6?Static Local Arrays and Automatic Local Arrays 靜態(tài)局部數(shù)組和自動(dòng)局部數(shù)組 260 6.7?Passing Arrays to Functions 將數(shù)組傳遞給函數(shù) 262 6.8?Sorting Arrays 數(shù)組排序 266 6.9?Case Study: Computing Mean, Median and Mode Using Arrays 案例分析:用數(shù)組來(lái)計(jì)算平均值、中值和眾數(shù) 268 6.10?Searching Arrays 數(shù)組查找 273 6.11?Multidimensional Arrays 多下標(biāo)數(shù)組 278 6.12?Variable-Length Arrays 可變長(zhǎng)數(shù)組 285 6.13?Secure C Programming 安全的C程序設(shè)計(jì) 288 7?C Pointers C指針 306 7.1?Introduction 引言 307 7.2?Pointer Variable Definitions and Initialization 指針變量的定義和初始化 308 7.3?Pointer Operators 指針運(yùn)算符 309 7.4?Passing Arguments to Functions by Reference 按引用向函數(shù)傳遞實(shí)參 311 7.5?Using the const Qualifier with Pointers 對(duì)指針使用const限定符 315 7.6?Bubble Sort Using Pass-by-Reference 采用按引用傳遞的冒泡排序 321 7.7?sizeof Operator sizeof運(yùn)算符 324 7.8?Pointer Expressions and Pointer Arithmetic 指針表達(dá)式和指針?biāo)阈g(shù)運(yùn)算 327 7.9?Relationship between Pointers and Arrays 指針和數(shù)組的關(guān)系 330 7.10?Arrays of Pointers 指針數(shù)組 334 7.11?Case Study: Card Shuffling and Dealing Simulation 案例研究:模擬撲克牌的洗牌和發(fā)牌 335 7.12?Pointers to Functions 指向函數(shù)的指針 340 7.13?Secure C Programming 安全的C程序設(shè)計(jì) 345 8?C Characters and Strings C字符和字符串 365 8.1?Introduction 引言 366 8.2?Fundamentals of Strings and Characters 字符串和字符基礎(chǔ) 366 8.3?Character-Handling Library 字符處理函數(shù)庫(kù) 368 8.4?String-Conversion Functions 字符串轉(zhuǎn)換函數(shù) 374 8.5?Standard Input/Output Library Functions 標(biāo)準(zhǔn)輸入/輸出庫(kù)函數(shù) 376 8.6?String-Manipulation Functions of the String-Handling Library 字符串處理函數(shù)庫(kù)中的字符串處理函數(shù) 381 8.7?Comparison Functions of the String-Handling Library 字符串處理函數(shù)庫(kù)中的比較函數(shù) 383 8.8?Search Functions of the String-Handling Library 字符串處理函數(shù)庫(kù)中的查找函數(shù) 385 8.9?Memory Functions of the String-Handling Library 字符串處理函數(shù)庫(kù)中的內(nèi)存處理函數(shù) 391 8.10?Other Functions of the String-Handling Library 字符串處理函數(shù)庫(kù)中的其他函數(shù) 395 8.11?Secure C Programming 安全的C程序設(shè)計(jì) 397 9?C Formatted Input/Output C格式化輸入/輸出 409 9.1?Introduction 引言 410 9.2?Streams 流 410 9.3?Formatting Output with printf 用printf函數(shù)實(shí)現(xiàn)格式化輸出 410 9.4?Printing Integers 打印整數(shù) 411 9.5?Printing Floating-Point Numbers 打印浮點(diǎn)數(shù) 412 9.6?Printing Strings and Characters 打印字符串或字符 414 9.7?Other Conversion Specifiers 其他的轉(zhuǎn)換說(shuō)明符 415 9.8?Printing with Field Widths and Precision 帶域?qū)捄途鹊拇蛴?416 9.9?Using Flags in the printf Format Control String 在printf函數(shù)的格式控制字符串中使用標(biāo)記 419 9.10?Printing Literals and Escape Sequences 打印文本和轉(zhuǎn)義序列 422 9.11?Reading Formatted Input with scanf 用scanf函數(shù)讀取格式化的輸入 422 9.12?Secure C Programming 安全的C程序設(shè)計(jì) 429 10?C Structures, Unions, Bit Manipulation and Enumerations C結(jié)構(gòu)體、共用體、位操作和枚舉類型 436 10.1?Introduction 引言 437 10.2?Structure Definitions 結(jié)構(gòu)體的定義 437 10.3?Initializing Structures 結(jié)構(gòu)體的初始化 440 10.4?Accessing Structure Members with . and -> 用.和->訪問(wèn)結(jié)構(gòu)體成員 440 10.5?Using Structures with Functions 在函數(shù)中使用結(jié)構(gòu)體 442 10.6?typedef typedef的使用 443 10.7?Example: High-Performance Card Shuffling and Dealing Simulation 實(shí)例分析:高性能的洗牌與發(fā)牌模擬 443 10.8?Unions 共用體 446 10.9?Bitwise Operators 位運(yùn)算符 448 10.10?Bit Fields 位域 457 10.11?Enumeration Constants 枚舉常量 460 10.12?Anonymous Structures and Unions 匿名的結(jié)構(gòu)體和共用體 462 10.13?Secure C Programming 安全的C程序設(shè)計(jì) 462 11?C File Processing C文件處理 473 11.1?Introduction 引言 474 11.2?Files and Streams 文件與流 474 11.3?Creating a Sequential-Access File 順序存取文件的創(chuàng)建 475 11.4?Reading Data from a Sequential-Access File 從順序存取文件中讀取數(shù)據(jù) 481 11.5?Random-Access Files 隨機(jī)存取文件 486 11.6?Creating a Random-Access File 隨機(jī)存取文件的創(chuàng)建 486 11.7?Writing Data Randomly to a Random-Access File 隨機(jī)地向一個(gè)隨機(jī)存取文件中寫(xiě)入數(shù)據(jù) 488 11.8?Reading Data from a Random-Access File 從一個(gè)隨機(jī)存取文件中讀取數(shù)據(jù) 491 11.9?Case Study: Transaction-Processing Program 案例研究:事務(wù)處理程序 493 11.10?Secure C Programming 安全的C程序設(shè)計(jì) 498 12?C Data Structures C數(shù)據(jù)結(jié)構(gòu) 509 12.1?Introduction 引言 510 12.2?Self-Referential Structures 自引用結(jié)構(gòu)體 511 12.3?Dynamic Memory Allocation 動(dòng)態(tài)內(nèi)存分配 511 12.4?Linked Lists 鏈表 512 12.5?Stacks 堆棧 521 12.6?Queues 隊(duì)列 527 12.7?Trees 樹(shù) 533 12.8?Secure C Programming 安全的C程序設(shè)計(jì) 538 13?C Preprocessor C預(yù)處理 550 13.1?Introduction 引言 551 13.2?#include Preprocessor Directive #include預(yù)處理命令 551 13.3?#define Preprocessor Directive: Symbolic Constants #define預(yù)處理命令:符號(hào)常量 552 13.4?#define Preprocessor Directive: Macros #define預(yù)處理命令:宏 553 13.5?Conditional Compilation 條件編譯 555 13.6?#error and #pragma Preprocessor Directives #error和#pragma預(yù)處理命令 556 13.7?# and ## Operators #和##運(yùn)算符 556 13.8?Line Numbers 行號(hào) 557 13.9?Predefined Symbolic Constants 預(yù)定義的符號(hào)常量 557 13.10?Assertions 斷言 558 13.11?Secure C Programming 安全的C程序設(shè)計(jì) 558 14?Other C Topics C語(yǔ)言的其他專題 563 14.1?Introduction 引言 564 14.2?Redirecting I/O I/O的重定向 564 14.3?Variable-Length Argument Lists 可變長(zhǎng)的參數(shù)列表 565 14.4?Using Command-Line Arguments 使用命令行實(shí)參 567 14.5?Compiling Multiple-Source-File Programs 編譯由多個(gè)源文件組成的程序 569 14.6?Program Termination with exit and atexit 使用exit和atexit終止程序 570 14.7?Suffixes for Integer and Floating-Point Literals 整型和浮點(diǎn)型常量的后綴 572 14.8?Signal Handling 信號(hào)處理 572 14.9?Dynamic Memory Allocation: Functions calloc and realloc 動(dòng)態(tài)內(nèi)存分配:函數(shù)calloc和realloc 575 14.10?Unconditional Branching with goto 用goto實(shí)現(xiàn)無(wú)條件轉(zhuǎn)移 575 15?C++ as a Better C; Introducing Object Technology C++,一個(gè)更好的C;介紹對(duì)象技術(shù) 581 15.1?Introduction 引言 582 15.2?C++ C++語(yǔ)言 582 15.3?A Simple Program: Adding Two Integers 簡(jiǎn)單程序:兩個(gè)整數(shù)相加 583 15.4?C++ Standard Library C++標(biāo)準(zhǔn)庫(kù) 586 15.5?Header Files 頭文件 586 15.6?Inline Functions 內(nèi)聯(lián)函數(shù) 588 15.7?C++ Keywords C++關(guān)鍵字 590 15.8?References and Reference Parameters 引用和引用形參 591 15.9?Empty Parameter Lists 空形參列表 596 15.10?Default Arguments 默認(rèn)實(shí)參 596 15.11?Unary Scope Resolution Operator 一元作用域運(yùn)算符 598 15.12?Function Overloading 函數(shù)重載 599 15.13?Function Templates 函數(shù)模板 602 15.14?Introduction to Object Technology and the UML 對(duì)象技術(shù)與UML簡(jiǎn)介 605 15.15?Introduction to C++ Standard Library Class Template vector C++標(biāo)準(zhǔn)庫(kù)類模板vector簡(jiǎn)介 608 15.16?Wrap-Up 本章小結(jié) 615 16?Introduction to Classes, Objects and Strings 類、對(duì)象和字符串簡(jiǎn)介 621 16.1?Introduction 引言 622 16.2?Defining a Class with a Member Function 定義一個(gè)具有成員函數(shù)的類 622 16.3?Defining a Member Function with a Parameter 定義一個(gè)有參成員函數(shù) 625 16.4?Data Members, set Member Functions and get Member Functions 數(shù)據(jù)成員,set成員函數(shù)與get成員函數(shù) 629 16.5?Initializing Objects with Constructors 用構(gòu)造函數(shù)初始化對(duì)象 634 16.6?Placing a Class in a Separate File for Reusability 將類放在單獨(dú)的文件中以增強(qiáng)重用性 638 16.7?Separating Interface from Implementation 將接口與實(shí)現(xiàn)分離 642 16.8?Validating Data with set Functions 用set函數(shù)驗(yàn)證數(shù)據(jù) 647 16.9?Wrap-Up 本章小結(jié) 652 17?Classes: A Deeper Look; Throwing Exceptions 類:深入學(xué)習(xí);拋出異常 659 17.1?Introduction 引言 660 17.2?Time Class Case Study Time類的案例學(xué)習(xí) 661 17.3?Class Scope and Accessing Class Members 類域和訪問(wèn)類的成員 667 17.4?Access Functions and Utility Functions 訪問(wèn)函數(shù)和工具函數(shù) 668 17.5?Time Class Case Study: Constructors with Default Arguments Time類的案例學(xué)習(xí):具有默認(rèn)實(shí)參的構(gòu)造函數(shù) 669 17.6?Destructors 析構(gòu)函數(shù) 675 17.7?When Constructors and Destructors Are Called 構(gòu)造函數(shù)與析構(gòu)函數(shù)的調(diào)用時(shí)間 675 17.8?Time Class Case Study: A Subtle Trap—Returning a Reference or a Pointer to a private Data Member Time類的案例學(xué)習(xí):隱蔽陷阱——返回private數(shù)據(jù)成員的引用或 指針 679 17.9?Default Memberwise Assignment 默認(rèn)按成員賦值 682 17.10?const Objects and const Member Functions const對(duì)象和const成員函數(shù) 684 17.11?Composition: Objects as Members of Classes 組合:對(duì)象作為類的成員 686 17.12?friend Functions and friend Classes 友元函數(shù)和友元類 692 17.13?Using the this Pointer 使用this指針 694 17.14?static Class Members static類成員 700 17.15?Wrap-Up 本章小結(jié) 705 18?Operator Overloading; Class string 運(yùn)算符重載;string類 715 18.1?Introduction 引言 716 18.2?Using the Overloaded Operators of Standard Library Class string 使用標(biāo)準(zhǔn)庫(kù)模板類string中的重載運(yùn)算符 717 18.3?Fundamentals of Operator Overloading 運(yùn)算符重載基礎(chǔ) 720 18.4?Overloading Binary Operators 重載二元運(yùn)算符 721 18.5?Overloading the Binary Stream Insertion and Stream Extraction Operators 重載流插入和流讀取運(yùn)算符 722 18.6?Overloading Unary Operators 重載一元運(yùn)算符 726 18.7?Overloading the Unary Prefix and Postfix ++ and –?– Operators 重載一元前置和后置++和–?–運(yùn)算符 727 18.8?Case Study: A Date Class 案例學(xué)習(xí):Date類 728 18.9?Dynamic Memory Management 動(dòng)態(tài)內(nèi)存管理 733 18.10?Case Study: Array Class 案例學(xué)習(xí):Array類 735 18.11?Operators as Member vs. Non-Member Functions 作為類的成員和作為非成員函數(shù)的運(yùn)算符函數(shù)的比較 748 18.12?Converting Between Types 類型轉(zhuǎn)換 748 18.13?explicit Constructors and Conversion Operators explicit構(gòu)造函數(shù)和轉(zhuǎn)換運(yùn)算符 750 18.14?Overloading the Function Call Operator ( ) 重載函數(shù)調(diào)用運(yùn)算符( ) 752 18.15?Wrap-Up 本章小結(jié) 753 19?Object-Oriented Programming: Inheritance 面向?qū)ο缶幊蹋豪^承 764 19.1?Introduction 引言 765 19.2?Base Classes and Derived Classes 基類和派生類 765 19.3?Relationship between Base and Derived Classes 基類和派生類的關(guān)系 768 19.4?Constructors and Destructors in Derived Classes 派生類的構(gòu)造函數(shù)與析構(gòu)函數(shù) 791 19.5?public, protected and private Inheritance public、protected和private繼承 793 19.6?Software Engineering with Inheritance 關(guān)于繼承的軟件工程 794 19.7?Wrap-Up 本章小結(jié) 794 20?Object-Oriented Programming: Polymorphism 面向?qū)ο缶幊蹋憾鄳B(tài) 799 20.1?Introduction 引言 800 20.2?Introduction to Polymorphism: Polymorphic Video Game 多態(tài)簡(jiǎn)介:多態(tài)的視頻游戲 801 20.3?Relationships Among Objects in an Inheritance Hierarchy 繼承層次結(jié)構(gòu)中對(duì)象間的關(guān)系 801 20.4?Type Fields and switch Statements 類型域和switch語(yǔ)句 815 20.5?Abstract Classes and Pure virtual Functions 抽象類和純虛函數(shù) 815 20.6?Case Study: Payroll System Using Polymorphism 案例學(xué)習(xí):利用多態(tài)的工資系統(tǒng) 817 20.7?(Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood” (選講)多態(tài)、虛函數(shù)及動(dòng)態(tài)聯(lián)編的“幕后機(jī)制” 832 20.8?Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info 案例學(xué)習(xí):利用多態(tài)和運(yùn)行時(shí)類型信息的工資系統(tǒng),具有向下類型轉(zhuǎn)換,使用dynamic_cast、typeid及type_info 835 20.9?Wrap-Up 本章小結(jié) 839 21?Stream Input/Output: A Deeper Look 輸入/輸出流:深入學(xué)習(xí) 844 21.1?Introduction 引言 845 21.2?Streams 流 846 21.3?Stream Output 輸出流 849 21.4?Stream Input 輸入流 851 21.5?Unformatted I/O Using read, write and gcount 用read、write和gcount進(jìn)行無(wú)格式I/O 854 21.6?Introduction to Stream Manipulators 流操縱符簡(jiǎn)介 855 21.7?Stream Format States and Stream Manipulators 流格式狀態(tài)和流操縱符 860 21.8?Stream Error States 流錯(cuò)誤狀態(tài) 869 21.9?Tying an Output Stream to an Input Stream 將輸出流綁定到輸入流上 872 21.10?Wrap-Up 本章小結(jié) 872 22?Exception Handling: A Deeper Look 異常處理:深入學(xué)習(xí) 881 22.1?Introduction 引言 882 22.2?Example: Handling an Attempt to Divide by Zero 實(shí)例:處理除數(shù)為0的異常 882 22.3?Rethrowing an Exception 重新拋出異常 888 22.4?Stack Unwinding 棧展開(kāi) 889 22.5?When to Use Exception Handling 何時(shí)使用異常處理 891 22.6?Constructors, Destructors and Exception Handling 構(gòu)造函數(shù)、析構(gòu)函數(shù)與異常處理 892 22.7?Exceptions and Inheritance 異常與繼承 893 22.8?Processing new Failures 處理new故障 893 22.9?Class unique_ptr and Dynamic Memory Allocation unique_ptr類與動(dòng)態(tài)內(nèi)存分配 896 22.10?Standard Library Exception Hierarchy 標(biāo)準(zhǔn)庫(kù)的異常層次結(jié)構(gòu) 899 22.11?Wrap-Up 本章小結(jié) 900 23?Introduction to Custom Templates 模板 906 23.1?Introduction 引言 907 23.2?Class Templates 類模板 907 23.3?Function Template to Manipulate a Class-Template Specialization Object 函數(shù)模板操縱類——模板的特化對(duì)象 912 23.4?Nontype Parameters 非類型形參 914 23.5?Default Arguments for Template Type Parameters 模板類型形參的默認(rèn)實(shí)參 914 23.6?Overloading Function Templates 重載函數(shù)模板 915 23.7?Wrap-Up 本章小結(jié) 915 A?C and C++ Operator Precedence Charts 附錄A 運(yùn)算符優(yōu)先級(jí)表 918 B?ASCII Character Set 附錄B ASCII字符集 922 C?Number Systems 附錄C 數(shù)值系統(tǒng) 923 D?Sorting: A Deeper Look 附錄D 排序:深入學(xué)習(xí) 936 E?Multithreading and Other C11 and C99 Topics 附錄E 多線程及其他C11和C99專題 956 Appendices on the Web 在線附錄 983 Index 索引 984
你還可能感興趣
我要評(píng)論
|