《标准C++与面向对象程序设计 英文版·第2版》PDF下载

  • 购买积分:17 如何计算积分?
  • 作  者:(美)王士弘(Wang,P.S)著
  • 出 版 社:北京:机械工业出版社
  • 出版年份:2003
  • ISBN:7111125428
  • 页数:572 页
图书介绍:本书以C++为工具讲述面向对象程序设计的基本理论和概念。

Introduction 1

ONE C++ Primer PartⅠ:Basics 8

1.1 Object-Oriented Program structure 8

1.2 Functions 9

1.3 Running the First Example 12

1.4 Statements 12

1.5 The while Statement 13

1.6 Simple Conditional Statements 16

1.7 Characters and Character Input and Output 17

1.8 More Basic Constructs 20

1.9 Data Types and Declarations 26

1.10 Operators and Expressions 29

1.11 Enumerations 35

1.12 Arrays 37

1.13 Pointers 40

1.14 An Example 41

1.15 Iteration Control 42

1.16 Choices by switch 46

1.17 Summary 48

Exercises 48

TWO C++ Primer PartⅡ:Object-Based Programming 51

2.1 Data Abstraction and Encapsulation 51

2.2 Function Calls and Argument Passing 58

2.3 Command-Line Arguments 61

2.4 Environment Variables 62

2.5 The string Class 63

2.6 Problem Solving with Objects 65

2.7 C++ I/O Streams 70

2.8 Error Handling 70

2.9 Object-Based Thinking 73

2.10 C++ Programming Tips 74

2.11 Summary 77

Exercises 78

THREE Key Constructs 80

3.1 Identifier Scoping 81

3.2 Namespaces 84

3.3 More on Declarations 86

3.4 Recursion 89

3.5 A Class of Fractions 93

3.6 Optional and Variable-Length Arguments 97

3.7 Overloading Functions 99

3.8 References 102

3.9 Read-Only Variables and Parameters 103

3.10 The typedef Declaration 105

3.11 Storage Allocation and Management 106

3.12 A Circular Buffer 109

3.13 Implicit Type Conversions 114

3.14 Explicit Type Cast 116

3.15 How to Use Header Files 117

3.16 Summary 119

Exercises 120

FOUR Arrays,Pointers,and Generic Code 123

4.1 Array Concepts and Declarations 123

4.2 Pointers and Address Arithmetic 125

4.3 Two-Dimensional Arrays 133

4.4 A Matrix Class 135

4.5 A Class of Polynomials 138

4.6 Array Objects:vector 141

4.7 Sorting Text Lines with Objects 143

4.8 Pointers and Function Calls 151

4.9 Arrays,Pointers,and References 154

4.10 Multiple Indirection 154

4.11 Generic Programs 156

4.12 A Generic Sorting Program 162

4.13 Pointers and Dynamically Allocated Storage 165

4.14 Summary 168

Exercises 169

5.1 Defining Classes 172

FIVE Classes and Objects 172

5.2 Creating and Initializing Objects 175

5.3 The Host Object 181

5.4 Internal-External Decoupling 182

5.5 Pocket Calculator Simulation 183

5.6 Built-in Operations for Objects 192

5.7 Object Destruction 193

5.8 Friends of a Class 195

5.9 Recursive Structures 197

5.10 Instance and Static Members 204

5.11 The Size of Objects 210

5.12 Generic Lists 211

5.14 Summary 216

5.13 Unions and Bit Fields 216

Exercises 217

SIX I/O Streams and the Standard Library 219

6.1 Different Header Files 219

6.2 C-Style String Input and Output 220

6.3 String Objects 222

6.4 A String Tokenizer 225

6.5 Operations on Characters 228

6.6 Numeric Computations 229

6.7 The I/O Stream Library 230

6.8 Stream I/O for Objects 240

6.9 I/O Manipulators 242

6.10 Summary 244

Exercises 245

SEVEN Inheritance and Class Derivation 248

7.1 Class Derivation 249

7.2 Derived Classes and Objects 252

7.3 Public Derivation 255

7.4 Derivation Principles 258

7.5 Access Control Under Class Derivation 259

7.6 Private Derivation 261

7.7 Specialization of Generic Classes 263

7.8 Type Relations Under Inheritance 265

7.9 Assignment of Objects 267

7.10 Copying of Objects 271

7.11 Derived-Object Assignment and Copying 274

7.12 Object Assignment and Copying via Derivation 276

7.13 Multiple Inheritance 278

7.14 The I/O Stream Class Hierarchy 282

7.15 Summary 283

Exercises 284

EIGHT Operator Overloading,Iterators,and Exceptions 287

8.1 Operator Overloading 287

8.2 A Reference-Count String Class 290

8.3 Overloading [] 293

8.4 Overloading ++ and -- 294

8.5 Smart Pointers 295

8.6 Iterators 296

8.7 Nested and Local Classes 299

8.8 Robust Classes 302

8.9 User-Defined Type Conversions 303

8.10 Error and Exception Handling 306

8.11 Matrix with Exceptions 314

8.12 Managing Free Storage 316

8.13 Summary 319

Exercises 320

NINE OOP Techniques 322

9.1 Programming with Plug-Compatible Objects 322

9.2 Run-Time Type Identification 330

9.3 A Generic Tree 335

9.4 Planning Uniform Public Interfaces 343

9.5 Destruction of Plug-Compatible Objects 352

9.6 Ordering Text Lines 354

9.7 Interfaces 357

9.8 Understanding Virtual Functions 359

9.9 Inheritance Planning 361

9.10 Object-Family Classes 363

9.11 Summary 371

Exercises 372

TEN Templates 375

10.1 Basic Concepts 375

10.2 Function Templates 377

10.3 Class Templates 383

10.4 Template Compilation 388

10.5 A List Template 390

10.6 Class Template Specialization 397

10.7 Derived-Class Template 397

10.8 A Generic Hash Table 400

10.9 Generic Programming Approaches 407

10.10 Summary 409

Exercises 409

ELEVEN Standard Containers 413

11.1 The STL 413

11.2 Standard Container Headers 414

11.3 Efficiency of Sequence Containers 416

11.4 Using stack 417

11.5 Associative Containers 418

11.6 Standard Container Iterators and typedefs 421

11.7 Generic Algorithms for Containers 426

11.8 Ordered Sets 429

11.9 Standard Functors 431

11.11 Pointers to Members 434

11.10 For More STL Information 434

11.12 Instance Functions as Functors 439

11.13 Summary 439

Exercises 440

TWELVE Web CGI Programming 442

12.1 About Networking 442

12.2 Internet Basics 444

12.3 The World-Wide Web 446

12.4 What Is HTML? 448

12.5 Dynamic Generation of Web Pages 450

12.6 HTML Produced from C++ 452

12.7 Forms in HTML 455

12.8 HTTP Message Formats 456

12.9 Writing CGI Programs 458

12.10 Receiving Form Data 459

12.11 User Feedback Handling 461

12.12 More Information 464

12.13 Summary 465

Exercises 465

THIRTEEN Object-Oriented Design 467

13.1 Decomposition Approaches 468

13.2 Object-Oriented Design Principles 469

13.3 Design Patterns 472

13.4 The CRC Method 474

13.5 interfacing to Existing Systems 475

13.6 Pocket Calculator Simulation 479

Exercises 488

13.7 Summary 488

FOURTEEN Compiling and Preprocessing 490

14.1 Compiling and Running C++ Programs 490

14.2 Preprocessing 492

14.3 Header Files 493

14.4 Symbolic Constants and Macros 494

14.3 Inline Functions Versus Macros 496

14.6 Conditional Text Inclusion 497

14.7 Once-Only Header Files 500

14.8 Standard Macros 500

14.9 Compilation and Execution 502

14.10 Summary 506

Exercises 507

A Summary of C++ Constructs 509

APPENDICES 509

B Summary of Special Member Functions 515

C C-Style Strings 516

D Unions and Bit Fields 519

E Interactive Debugging with dbx 525

F Functions with a Variable Number of Arguments 528

G Operator Precedence 531

H Implicit Type Conversions 532

I C++ Library Functions Common with C 534

J C-Style Input/Output 542

K Interfacing C++ and C Programs 547

L Header Files 551

Index 552