• Chapter 15: Friends, Exceptions, and More— Chapter 15 extends the discussion of friends to include friend classes and friend member functions. Then it presents several new developments in C++, beginning with exceptions, which provide a mechanism for dealing with unusual program occurrences, such an inappropriate function argument values and running out of memory. Then you’ll learn about RTTI, a mechanism for identifying object types. Finally, you’ll learn about the safer alternatives to unrestricted typecasting.
• Chapter 16: The string Class and the Standard Template Library— Chapter 16 discusses some useful class libraries recently added to the language. The string class is a convenient and powerful alternative to traditional C-style strings. The auto_ptr class helps manage dynamically allocated memory. The STL provides several generic containers, including template representations of arrays, queues, lists, sets, and maps. It also provides an efficient library of generic algorithms that can be used with STL containers and also with ordinary arrays. The valarray template class provides support for numeric arrays.
• Chapter 17: Input, Output, and Files— Chapter 17 reviews C++ I/O and discusses how to format output. You’ll learn how to use class methods to determine the state of an input or output stream and to see, for example, whether there has been a type mismatch on input or whether the end-of-file has been detected. C++ uses inheritance to derive classes for managing file input and output. You’ll learn how to open files for input and output, how to append data to a file, how to use binary files, and how to get random access to a file. Finally, you’ll learn how to apply standard I/O methods to read from and write to strings.
• Chapter 18: Visiting with the New C++ Standard— Chapter 18 begins by reviewing several C++11 features introduced in earlier chapters, including new types, uniform initialization syntax, automatic type deduction, new smart pointers, and scoped enumerations. The chapter then discusses the new rvalue reference type and how it’s used to implement a new feature called
• Appendix A: Number Bases— Appendix A discusses octal, hexadecimal, and binary numbers.
• Appendix B: C++ Reserved Words— Appendix B lists C++ keywords.
• Appendix C: The ASCII Character Set— Appendix C lists the ASCII character set, along with decimal, octal, hexadecimal, and binary representations.
• Appendix D: Operator Precedence— Appendix D lists the C++ operators in order of decreasing precedence.
• Appendix E: Other Operators— Appendix E summarizes the C++ operators, such as the bitwise operators, not covered in the main body of the text.
• Appendix F: The string Template Class— Appendix F summarizes string class methods and functions.
• Appendix G: The Standard Template Library Methods and Functions— Appendix G summarizes the STL container methods and the general STL algorithm functions.
• Appendix H: Selected Readings and Internet Resources— Appendix H lists some books that can further your understanding of C++.
• Appendix I: Converting to ISO Standard C++— Appendix I provides guidelines for moving from C and older C++ implementations to ANSI/ISO C++.
• Appendix J: Answers to Chapter Review— Appendix J contains the answers to the review questions posed at the end of each chapter.
Note to Instructors
One of the goals of this edition of
• This book describes generic C++, so it isn’t dependent on a particular implementation.
• The contents track the ISO/ANSI C++ standards committee’s work and include discussions of templates, the STL, the string class, exceptions, RTTI, and namespaces.
• It doesn’t assume prior knowledge of C, so it can be used without a C prerequisite. (Some programming background is desirable, however.)
• Topics are arranged so that the early chapters can be covered rapidly as review chapters for courses that do have a C prerequisite.