Contents

Preface

1Introduction

1.1The Development of Computer Programming Languages

1.1.1Machine Language and Assembly Language

1.1.2High-level Language

1.1.3Object-oriented Language

1.2Object-oriented Method

1.2.1The Origin of Object-oriented Method

1.2.2Basic Concepts of Object-oriented

1.3Object-oriented Software Development

1.3.1Analysis

1.3.2Design

1.3.3Programming

1.3.4Test

1.3.5Maintenance

1.4Representation and Storage of Information

1.4.1Digital System of Computers

1.4.2Conversions among Numeral Systems

1.4.3Storage Units of Information

1.4.4Binary-coded Representation

1.4.5Fixed Point Number and Floating-Point Number

1.4.6The Number Range that can be Represented

1.4.7Representation of Non-numerical Information

1.5The Development Process of Programs

1.5.1Elementary Terms

1.5.2The Development Process

1.6Summary

Exercises

2Elementary C++ Programming

2.1An Overview of C++ Language

2.1.1Origins of C++

2.1.2Characteristics of C++

2.1.3C++ Programming Examples

2.1.4Character Set

2.1.5Lexical Tokens

2.2Basic Data Types and Expressions

2.2.1Basic Data Types

2.2.2Constants

2.2.3Variables

2.2.4Symbol Constants

2.2.5Operators and Expressions

2.2.6Statement

2.3Data Input and Output

2.3.1I/O Stream

2.3.2Predefined Input and Output Operator

2.3.3Simple I/O Format Control

2.4The Fundamental Control Structures of Algorithms

2.4.1Achieving Case Structure Using if Statement

2.4.2Multiple Selection Structure

2.4.3Loop Structure

2.4.4Nestings of Loop Structure and Case Structure

2.4.5Other Control Statements

2.5User-Defined Data Type

2.5.1typedef Declaration

2.5.2Enumeration Type – enum

2.5.3Structure

2.5.4Union

2.6Summary

Exercises

3Functions

3.1Definition and Use of Function

3.1.1Definition of Function

3.1.2Function Calls

3.1.3Passing Parameters Between Functions

3.2Inline Functions

3.3Default Formal Parameters in Functions

3.4Function Overloading

3.5Using C++ System Functions

3.6Summary

Exercises

4Class and Object

4.1Basic Features of Object-Oriented Design

4.1.1Abstraction

4.1.2Encapsulation

4.1.3Inheritance

4.1.4Polymorphism

4.2Class and Object

4.2.1Definition of Class

4.2.2Access Control to Class Members

4.2.3Member Function of Class

4.2.4Object

4.2.5Program Instance

4.3Constructor and Destructor

4.3.1Class Constructors

4.3.2The Copy Constructor

4.3.3Class Destructor

4.3.4Program Instance

4.4Combination of Classes

4.4.1Combination

4.4.2Forward Declaration

4.5UML

4.5.1Brief Introduction of UML

4.5.2UML Class Diagrams

4.6Program Instance – Personnel Information Management Program

4.6.1Design of Class

4.6.2Source Code and Description

4.6.3Running Result and Analyses

4.7Summary

Exercises

5Data Sharing and Protecting

5.1Scope and Visibility of Identifiers

5.1.1Scope

5.1.2Visibility

5.2Lifetime of Object

5.2.1Static Lifetime

5.2.2Dynamic Lifetime

5.3Static Members of Class

5.3.1Static Data Member

5.3.2Static Function Member

5.4Friend of Class

5.4.1Friend Function

5.4.2Friend Class

5.5Protection of Shared Data

5.5.1Constant Reference

5.5.2Constant Object

5.5.3Class Members Modified by const

5.6Multifile Structure and Compilation Preprocessing Directives

5.6.1General Organization Structure of C++ Program

5.6.2External Variable and External Function

5.6.3Standard C++ Library and Namespace

5.6.4Compilation Preprocessing

5.7Example – Personnel Information Management Program

5.8Summary

Exercises

6Arrays, Pointers, and Strings

6.1Arrays

6.1.1Declaration and Use of Arrays

6.1.2Storage and Initialization of Arrays

6.1.3Using Arrays as Function Parameters

6.1.4Object Arrays

6.1.5Program Examples

6.2Pointers

6.2.1Access Method of Memory Space

6.2.2Declaration of Pointer Variables

6.2.3Operations Related to Addresses – ‘*’ and ‘&’

6.2.4Assignment of Pointers

6.2.5Pointer Operations

6.2.6Using Pointers to Process Array Elements

6.2.7Pointer Arrays

6.2.8Using Pointers as Function Parameters

6.2.9Pointer-Type Functions

6.2.10Pointers that Point to Functions

6.2.11Object Pointers

6.3Dynamic Memory Allocation

6.3.1new Operation and delete Operation

6.3.2Dynamic Memory Allocation and Release Functions

6.4Deep Copy and Shallow Copy

6.5Strings

6.5.1Using Character Arrays to Store and Process Strings

6.5.2The string Class

6.6Program Example – Personnel Information Management Program

6.7Summary

Exercises

7Inheritance and Derivation

7.1Inheritance and Derivation of Class

7.1.1Instances of Inheritance and Derivation

7.1.2Definition of Derived Class

7.1.3The Generation Process of Derived Classes

7.2Access Control

7.2.1Public Inheritance

7.2.2Private Inheritance

7.2.3Protected Inheritance

7.3Type Compatible Rule

7.4Constructor and Destructor of Derived Class

7.4.1Constructor

7.4.2Copy Constructor

7.4.3Destructor

7.5Identification and Access of Derived-Class Member

7.5.1Scope Resolution

7.5.2Virtual Base Class

7.5.3Constructors of Virtual Base Class and Derived Class

7.6Program Example: Solving Linear Equations using Gaussian Elimination Method

7.6.1Fundamental Principles

7.6.2Analysis of the Program Design

7.6.3Source Code and Explanation

7.6.4Execution Result and Analysis

7.7Program Example: Personnel Information Management Program

7.7.1Problem Description

7.7.2Class Design

7.7.3Source Code and Explanation

7.7.4Execution Result and Analysis

7.8Summary

Exercises

8Polymorphism

8.1An Overview of Polymorphism

8.1.1Types of Polymorphism

8.1.2Implementation of Polymorphism

8.2Operator Overload

8.2.1Rules of Operator Overload

8.2.2Operator Overloaded as Member Function

8.2.3Operator Overloaded as Friend Function

8.3Virtual Function

8.3.1Ordinary Virtual Function Member

8.3.2Virtual Destructor

8.4Abstract Classes

8.4.1Pure Virtual Functions

8.4.2Abstract Classes

8.5Program Instance: Variable Stepwise Trapezoid Method to Calculate Functional Definite Integral

8.5.1Basic Principle

8.5.2Analysis of Program Design

8.5.3Source Code and Explanation

8.5.4Execution Result and Analysis

8.6Program Instance: Improvement on Staff Information Management System for a Small Corporation

8.7Summary

Exercises

9Collections and Their Organization

9.1Function Templates and Class Templates

9.1.1Function Template

9.1.2Class Template

9.2Linear Collection

9.2.1Definition of Linear Collection

9.2.2Direct Accessible Linear Collection – Array

9.2.3Sequential Access Collection – Linked List

9.2.4Stack

9.2.5Queues

9.3Organizing Data in Linear Collections

9.3.1Insertion Sort

9.3.2Selection Sort

9.3.3Exchange Sort

9.3.4Sequential Search

9.3.5Binary Search

9.4Application – Improving the HR Management Program of a Small Company

9.5Summary

Exercises

10Generic Programming and the Standard Template Library

10.1Generic Programming

10.1.1Introduction

10.1.2Namespace

10.1.3Differences of Naming Conventions Between C/C++

10.1.4Concepts of STL

10.1.5Containers

10.1.6Adapters

10.1.7Iterators

10.1.8Algorithms

10.1.9Interfaces of Containers

10.2Containers in STL

10.2.1Sequential Containers

10.2.2Adapters of Containers

10.3Iterators

10.3.1Types of Iterators

10.3.2Auxiliary Functions in Iterators

10.4Algorithms in STL

10.4.1Using the Algorithms

10.4.2Nonmutating Sequence Algorithms

10.4.3Mutating Sequence Algorithms

10.4.4Sorting Related Algorithms

10.4.5Numerical Algorithms

10.5Function Objects

10.6Application – Improving the HR Management Program of a Small Company

10.7Summary

Exercises

11The I/O Stream Library and Input/Output

11.1I/O Stream’s Concept and the Structure of a Stream Library

11.2Output Stream

11.2.1Construct Output Object

11.2.2The Use of Inserter and Manipulator

11.2.3Output File Stream Member Function

11.2.4Binary Output File

11.3Input Stream

11.3.1Construct Input Stream Object

11.3.2Extraction Operator

11.3.3Input Stream Manipulator

11.3.4Input Stream Member Function

11.4Input/output Stream

11.5Example-improve Employee Information Management System

11.6Summary

Exercises

12Exception Handling

12.1Basic Concepts of Exception Handling

12.2The Implementation of Exception Handling in C++

12.2.1The Syntax of Exception Handling

12.2.2Exception Interface Declaration

12.3Destruction and Construction in Exception Handling

12.4Exception Handling of Standard Library

12.5Program Example Improvement to Personal Information Administration Program in a Small Company

12.6Summary

Exercises

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset