Ivor Horton's Beginning ANSI C++: The Complete Language

Front Cover
Apress, Jan 1, 2008 - Computers - 1120 pages
WELCOME ro Beginning ANSI C++: The Complete Language, Third Edition. This is a tuto rial guide to Standard C++. During the course of the book you'll cover all the funda mentals of syntax, grammar, object-oriented capability, and the principal features of the standard library. You'll soon gain enough programming know-how to write your own C++ applications. Why C++? C++ is arguably the most widely used programming language in existence. It's used in professional application development because of its immense flexibility, power, and efficiency. For high-performance code across a vast range of programming contexts, C++ is unrivalled. It's also much more accessible than many people assume. With the right guidance, getting a grip on C++ is easier than you might imagine. By developing your C++ skills, you'll learn a language already used by millions, and you'll acquire a new tool in your programming toolbox that is likely to be more powerful than any of the others. The Standard for C++ In 1998, the International Standard for C++, ISO/IEC 14882, was finally approved and adopted by the American National Standards Institute (ANSI) and the International Committee for Information Technology Standards (INCITS). This was the culmination of nine years of work by a joint ANSI/ISO committee whose objective was to establish a single definition of the C++ programming language that would be accepted worldwide.
 

Contents

Basic Ideas
1
Why Is C++ Such a Great Language?
5
Keywords
12
C++ Source Characters
20
Documenting Your Programs
27
Basic Data Types and Calculations
35
Using Variables
46
The Assignment Operator
56
Defining Your Own Data Types
515
Private Members of a Class
537
The Pointer Named this
550
Static Members of a Class
565
Class Operations
577
Controlling Access to a Class
595
References in Classes
611
Operator Overloading
617

The const Keyword
62
FloatingPoint Operations
70
Working with Characters
81
Functional Notation for Initial Values
87
More on Handling Basic Data Types
91
Finding Out About Types
99
Enumerated Data Types
119
Declaring External Variables
134
Choices and Decisions in Your Programs
139
The ifelse Statement
153
The switch Statement
167
Repeating One or More Statements
177
The dowhile Loop
182
Nested Loops
199
Breaking Out of a Loop
207
Summary
213
Arrays and Strings
215
Multidimensional Arrays
231
A Better Class of String
240
Arrays of Type string
275
Pointers
279
Initializing Pointer
287
Constant Pointers and Pointers to Constants
299
Dynamic Memory Allocation
314
Summary
327
Programming with Functions
329
Passing Arguments to a Function
340
Default Argument Values
359
Static Variables
370
More on Functions
377
Pointers to Functions
398
Recursion
406
Summary
416
Program Files and Preprocessing Directives
419
Namespace
431
Preprocessing Your Source Code
449
Logical Preprocessing Directives
461
Debugging Methods
468
Summary
478
Creating Your Own Data Types
481
Understanding Unions
500
Exercises
513
Summary
664
Inheritance
667
The Access Level of Inherited Class Members
681
Destructors Under Inheritance
695
Converting Between Related Class Types
711
Virtual Functions and Polymorphism
715
The Cost of Polymorphism
744
Identifying Types at Runtime
757
Pointers to Class Members
759
Summary
769
Program Errors and Exception Handling
771
Class Objects As Exceptions
785
Functions That Throw Exceptions
800
Summary
809
Using Class Templates To Create Families of Classes
811
Explicit Template Instantiation
844
Special Cases
846
More Advanced Class Templates
859
Input and Output Operations
863
Stream Classes
866
File Streams
874
Unformatted Stream Operations
890
Using Binary Mode Stream Operations
896
ReadWrite Operations on a Stream
906
String Streams
914
Summary
936
Introducing the Standard Template Library
939
Using the vector Container
947
Creating Your Own Iterators
969
The list Container
984
The Associative Containers
993
Performance and Specialization
1004
Appendix A ASCII Codes
1009
Appendix B C++ Keywords
1013
Standard Library Headers
1015
General Purpose Algorithms
1020
Operator Precedence and Associativity
1021
Appendix E Understanding Binary and Hexadecimal Numbers
1025
Hexadecimal Numbers
1027
Appendix F Example Project
1033
Index
1039
Copyright

Other editions - View all

Common terms and phrases

About the author (2008)

Ivor Horton is self-employed in consultancy and writes programming tutorials. He worked for IBM for many years and holds a bachelor's degree, with honors, in mathematics. Horton's experience at IBM includes programming in most languages (like assembler and high-level languages on a variety of machines), real-time programming, and designing and implementing real-time closed loop industrial control systems. He has extensive experience teaching programming to engineers and scientists (Fortran, PL/1, APL, etc.). Horton is an expert in mechanical, process, and electronic CAD systems; mechanical CAM systems; and DNC/CNC systems.

Bibliographic information