C++专家导引(英文版)

C++专家导引(英文版)
作 者: 温斯顿
出版社: 机械工业出版社
丛编项: 经典原版书库
版权说明: 本书为出版图书,暂不支持在线阅读,请支持正版图书
标 签: C++
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

  PatrickHenryWinston,麻省理工学院人工智能和计算机科学教授。他在人工智能领域十分著名,著有多部思路清晰且见解独到的专著。除本书外,他还著有《OntoC》、《OntoJava2》、《ArtificialIntelligence》等书。

内容简介

如果你希望C++成为你驾驭的程序设计语言,如果你希望学习语言的精华并为编程实践做准备,如果你希望学到面向对象程序设计的优势,以及如何通过C++类层次结构的设计原理最大化这些优势,本书正是你的最佳选择。以一个简短且具代表性的C++程序体现关键概念是本书的一大特色。这个程序采用容器和有轨电车的知识来报告铁道运输的货运能力,从而体现了C++类抽象自然类的能力。书中用类概念编写的程序体现了如何创建类和对象;如何定义构造函数、阅读器(Reader)和写入器(Writer)函数;如何发挥数据抽象的优势;如何继承成员变量值和成员函数;在运行时如何创建新的类对象;在运行时如何定位正确的函数;在类的层次结构中如何使用构造函数;如何使用保护、私有成员变量和成员函数;如何使用保护和私有的类派生;如何设计类的层次结构;如何采用模板重用类的定义,等等。本书特色●通过逐步改进一个简短且完整的程序解释每个新思想●以易于掌握的if-then规则的形式概括关键知识点●强调面向对象程序设计、过程抽象和数据抽象的实质●帮助读者建立一个通用的、模板模式的个人类库

图书目录

1 HOW THIS BOOK TEACHES YOU THE LANGUAGE

why you should learn C++

object-oriented programming languages

procedure-oriented programing languages

programming cliches

2 HOW TO COMPILE AND RUN A SIMPLE PROGRAM

compiling, linking, and executing

statements and declarations

the output operator, <<, and character strings

case sensitivity and blank insensitivity

operators and operands

3 HOW TO DECLARE VARIABLES

data types and variable declarations

initialization and assignment

integral data types

4 HOW TO WRITE ARrFHMETIC EXPRESSIONS

arithmetic

precedence and association

binary and unary operators

type casting

5 HOW TO WRITE STATEMENTS THAT READ INFORMATION FROM YOUR KEYBOARD

the input operator, >>

input redirection

6 HOW TO DEFINE SIMPLE FUNCTIONS

calling and returning from functions

arguments, parameters, and values

function overloading

7 HOW TO BENEFIT FROM PROCEDURE ABSTRACTION

making programs easier to reuse, read, and debug

making programs easier to augment, improve, and adapt

8 HOW TO WORK WITH LOCAL AND GLOBAL VARIABLES

extent and scope

local, static, and global variables

compound statements

9 HOW TO CREATE CLASSES AND OBJECTS

user-defined data types, classes, and objects

class specification and member variables

the class-member operator

10 HOW TO DEHNE MEMBER FUNCTIONS

the special, class-object argument

member function prototypes

the class-scope operator, : :

11 HOW TO DEFINE CONSTRUCTOR MEMBER FUNCTIONS

the default constructor

argument-bearing constructors

12 HOW TO DEFHNE READER AND WRITER MEMBER FUNCTIONS

reader and writer member functions

imaginary member variables

13 HOW TO BFaNEF1T FROM DATA ABSTRACTION

access functions and data abstraction

making programs easier to reuse

14 HOW TO PROTECT MEMBER VARIABLES FROM HARMFUL REFERENCE

private member variables and member functions

the public interface

15 HOW TO DEFINE CLASSES THAT INHERIT VARIABLES AND FUNCTIONS

inheriting member variables and member functions

derived classes and base classes

multiple inheritance and shadowing

16 HOW TO DESIGN CLASSES AND CLASS HIERARCHIES

explicit representation

reusing functions and avoiding duplication

the local-view and the look-it-up principles

the need-m-know and the keep-it-simple principles

17 HOW TO PERFORM TESTS USING NUMERICAL PREDICATES

equal, ==, and not equal, !--

greater than, >, and less than, <

not, !

18 HOW TO WRITE ONF.-WAY AND TWO-WAY CONDITONAL STATEMENTS

Boolean expressions

if and if else

empty and compound statements

the conditional operator, ?:

19 HOW TO COMBINE BOOLEAN EXPRESSIONS

and, &&, and or, ::

evaluation order

20 HOW TO WRITE ITERATION STATEMENTS

while and for statements

augmented assignment operators

increment, ++, and decrement, --, operators

side effects and evaluation order

21 HOW TO PROCESS DATA IN FILES

while reading and for reading loops

action of the input operator at the end of a file

22 HOW TO WRITE RECURSIVE FUNCTIONS

functions that call themselves

the base part and the recursion part

efficiency considerations

23 HOW TO SOLVE DEFINITION ORDERING PROBLEMS WITH FUNCTION PROTOTYPES

the definition-before-call requirement

declare now, define later

24 HOW TO WORK WITH ARRAYS OF NUMBERS

arrays of numeric elements

filling a numeric array from a file

25 HOW TO WORK WITH ARRAYS OF CLASS OBJECTS

arrays of class-object elements

filling an object array from a file

26 HOW TO CREATE FILE STREAMS FOR INPUT AND OUTPUT

creating streams

opening and closing files for reading and writing

Ifstream and of stream Statements

27 HOW TO CREATE NEW CLASS OBIECTS AT RUN TIME

pointers and the free store

allocating space with new

the dereferencing operator, *

the class-pointer operator, ->

the address-of operator, &

28 HOW TO STORE POintERS TO CLASS OBJECTS

wasting space by defining too-large object arrays

saving space by defining too-large pointer arrays

29 HOW TO WRITE PROGRAMS THAT FIND

MEMBER FUNCTIONS AT RUN TIME

arrays of pointers to miscellaneous obiects

virtual member functions

pure virtual functions

30 HOW TO WRITE MULTIWAY CONDTIONAL STATEMENTS

switch statements

the cerr output stream

exit statements

31 HOW TO USE ENUMERATONS TO IMPROVE READABILITY

the mnemonic sterility of numbers

the enumeration data type

the integral data types

the character data type

32 HOW TO WRITE CONSTRUCTORS THAT CALL OTHER CONSTRUCTORS

33 HOW TO WRITE MEMBER FUNCTIONS THAT CALL OTHER MEMBER FUNCTIONS

34 HOW TO USE PROTECTED AND PRIVATE VARIABLES AND FUNCTIONS

35 HOW TO USE PROTECTED AND PRIVATE CLASS DERIVATIONS

36 HOW TO WRITE FUNCTIONS THAT RETURN CHARACIXR STRINGS

character strings and character arrays

the null character, \O

37 HOW TO USE CALL-BY-REFERENCE PARAMETERS

call by value and incomplete argument copy/ng

using call by reference to access entire objects

using call by reference to save time

using call by reference to alter arguments

38 HOW TO OVERLOAD THE OUTPUT OPERATOR

copy-free function return

pass-through objects

operator overloading

39 HOW TO PRODUCE TABULAR DISPLAYS

the peintf function

field widths and padding characters

printing strings, characters, and numbers

40 HOW TO WroTE STATEMEUTS THAT READ CHARACTER STRINGS FROM HLES

input buffers

using the input operator with a character pointer

array names viewed as constant pointers

41 HOW TO TEST STRING CHARACTERS

characters viewed as integers

obtaining character codes

using enumeration constants as character codes

42 HOW TO DEPOSIT CHARACTER STRINGS INTO CLASS OBJECTS

creating character arrays at run time using new

using strlen and strcpy to measure and copy

43 HOW TO RECLAIM MEMORY WITH DELETE AND DESTRUCTORS

garbage and memory leaks

delete viewed as the complement of new

destructor member functions

stadic member variables

44 HOW TO PREVENT OBJECT COPYING

the excess-reclamation bug

defining your own copy constructor

45 HOW TO ORGANIZE A MULTIPLE-FILE PROGRAM

header files

separating class and member-function definitious

inline functions

managing global variables with static and extern

46 HOW TO COMPILE A MULTIPLE-FILE PROGRAM

recording file dependencies in a makefile

maintaining systems using the make utility

47 HOW TO IMPLEMENT LISTS

using lists to conserve memory

internal and external pointers

the null pointer, NULL

48 HOW TO MAKE ONE CLASS A FRIEND OF ANOTHER CLASS

49 HOW TO REUSE CLASS DEFINITIONS US/NG TEMPLATES

50 HOW TO ITERATE OVER LISTS USING ITERATION CLASS OBJECTS

APPENDIX A: OPERATOR PRECEDENCE

APPENDIX B: FORMATTED DISPLAY

COLOPHON

INDEX