Home > Store

Object-Oriented Programming in C++, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Object-Oriented Programming in C++, 2nd Edition

Book

  • Sorry, this book is no longer in print.
Not for Sale

About

Features

  • NEW - Up-to-date C++ coverage—Discusses new-style headers, new-style casts, type bool, type string, stringstream classes, namespaces, namespace std., exception handling, run-time type identification, operator new[ ], the template input/output classes, and more.
    • Keeps students abreast of the most recent changes in C++ programming. Ex.___

  • NEW - STL (standard template library)—Examines such STL features as containers, iterators, algorithms, and function objects.
    • Gives students a firm understanding of STL and helps them understand the predicted, major impact it will have on C++. Ex.___

  • NEW - Early introduction of inheritance and polymorphism.
    • Helps students recognize the underlying importance of inheritance and polymorphism to the object-oriented programming paradigm. Ex.___

  • NEW - Microsoft Foundation Classes.
    • Presents students with a solid explanation of how to use the popular Microsoft Visual C++ with the Microsoft Foundation Classes. Ex.___

  • NEW - Extensively revised sample applications—Integrated in almost every chapter, each sample applications section contains a statement of a problem, sample input and output, a solution to the problem, and a well-documented implementation of the problem in C++; most conclude with an extended discussion.
    • Enables students to carefully examine and fully grasp the concept or programming technique under discussion. Ex.___

  • NEW - Boxed figures—Visually separates figures from the narrative.
    • Helps students assimilate information in a more orderly manner by giving them a clear, visually organized presentation of material. Ex.___

  • NEW - Companion World Wide Website at www.prenhall.com/johnsonbaugh—Contains the book's source code, header files, and data files; sample syllabi; transparencies; and an errata list.
    • Provides students and instructors with up-to-date text support. Ex.___

  • Standard input/output library—Offers a full explanation of how to use the standard input/output library, and incorporates all of the latest changes to the C++ programming language.
    • Enables students to use the standard input/output library to its fullest advantage. Ex.___

  • Major data structures implemented in C++—Includes stack and relative files.
    • Shows students C++ in action in the real world. Ex.___

  • Worked examples.
    • Shows students how to code and explains tricky parts of C++. Ex.___

  • Self-test exercises.
    • Allows students to check their understanding of the section. Ex.___

  • Programming exercises.
    • Gives students valuable practice in coding entire programs that are both interesting and applicable. Ex.___

  • Lists of common programming errors—Highlights certain aspects of the language that are easily misunderstood; found at the end of most chapters.
    • Alerts students to potential programming pitfalls and offers important tips and guidance for avoiding such mistakes; provides a handy “error” checklist. Ex.___

  • C++ Postscript sections—Discusses less-used parts of the language and provides additional technical details about certain parts of the language.
    • Broadens students' knowledge base. Ex.___

  • Stunning illustrations.
    • Enriches students' learning experience by adding visual appeal and clarifying discussions. Ex.___

  • Solutions to odd-numbered exercises—Found at the end of the book.
    • Allows students to check whether they solved exercises correctly and look for alternative approaches. Ex.___

  • Two practical appendices—Contains the ASCII table and a list of some of the most useful C++ functions and class methods; includes descriptions of the parameters and return values for each, the header to include, and what the function or method does.
    • Provides students with a handy reference for in- and out-of-class use. Ex.___

Description

  • Copyright 2000
  • Dimensions: 7" x 9-1/4"
  • Pages: 640
  • Edition: 2nd
  • Book
  • ISBN-10: 0-13-015885-2
  • ISBN-13: 978-0-13-015885-7

As users of the highly successful first edition of this book can attest, this second edition is for both the student and the professional wanting to master the latest updates to the C++ programming language. The authors combine their years of experience to teach the power and flexibility of C++ through object-oriented programming applications. This new book reflects the clear presentation and excellent enhanced examples and programming exercises for which the authors have become well know.

  • PRESENTS UP-TO-DATE C++ with new style headers, new-style casts, type book, type string, stringstream classes, namespace std, exception handling, run-time type identification, operator new , the template input/output classes, and STL (standard template library)
  • COVERS STL (standard template library) with the features of containers, iterators, algorithms, and function objects
  • EXPLAINS HOW TO USE the standard input/output library containing all the latest changes
  • PROVIDES SOLUTIONS to odd-numbered exercises
  • FEATURES TWO APPENDIXES for reference that includes an ASCII table; C++ functions and class methods
  • INCLUDES Microsoft Visual C++™ student compiler on CD-ROM
  • COMPANION WEBSITE supplements text with book's source code, header files, and data files; sample syllabi; transparencies; and an errata list

Sample Content

Table of Contents



1. Object-Oriented Programming.


2. From C to C++.


3. Classes.


4. Inheritance.


5. Polymorphism.


6. Operator Overloading.


7. Templates and the Standard Template Library.


8. The C++ Input/Output Class Hierarchy.


9. Object-Oriented Programming In The Microsoft Foundation Classes.


Appendix A. ASCII Table.


Appendix B. Selected C++ Functions and Methods.


Hints and Solutions to Odd-Numbered Exercises.


Index.

Preface

Preface

This book is based on C++ courses given by the authors at DePaul University and can be used for self-study or for a course on object-oriented programming in C++. We assume no prior knowledge of C++, but we do assume knowledge of C. Coverage of C at the level provided in R. Johnsonbaugh and M. Kalin, Applications Programming in ANSI C, 3rd ed. (Upper Saddle River, N.J.: Prentice Hall, 1996) provides sufficient background for this book. The book and its supplements— a CDROM containing Microsoft's C++ compiler, an Instructor's Guide, and a World Wide Web site— provide a comprehensive support system to help the reader master C++. In this book, as in our other C and C++ books, we make extensive use of examples, figures, self-study exercises, sample applications, lists of common programming errors, and programming exercises. We strive for clarity throughout the book and also illustrate a variety of good programming practices.

This book treats object-oriented principles (see Chapter 1); emphasizes sound programming practices; introduces templates and the standard template library (see Chapter 7); presents in depth the C++ input/output class hierarchy (Chapter 8); features major, useful examples (e.g., a stack class, Sections 3.2 and 7.2; and a random access file class, Section 8.6); and introduces objectoriented programming in the Microsoft Foundation Classes in Chapter 9.

The C++ language presented here is based on the approved standard. As such it contains the latest additions and changes to the language including

  • The logical type bool.

  • The string class.

  • New-style headers.

  • Namespaces and the namespace std.

  • New-style casts.

  • STL (Standard Template Library).

  • Exception handling.

  • Run-time type identification.

  • The operator new .

  • The template input/output classes.

  • The stringstream classes.

Overview

During the 1980s and early 1990s, C became the language of choice for many applications and systems programmers. Most major software available for personal computers was written in C: spreadsheets, word processors, databases, communications packages, statistical software, graphics packages, and so on. Virtually all software written for the UNIX environment was likewise written in C, and many mainframe systems meant to be ported from one platform to another were also coded in C. In the early 1980s, Bjarne Stroustrup of AT&T Bell Labs developed C++ as an extension of C that supports object-oriented programming, a type of programming that is well suited to the large, complex software systems now written for all platforms, from the cheapest personal computers to the most expensive mainframes. C++ also corrects some shortcomings in C, which C++ includes as a subset, and it supports abstract data types and generic functions through templates.

C++ is a highly complex language. Fortunately, most C++ programmers can benefit from its power without mastering each and every one of its features. We focus on the most useful aspects of the language, but we place some of the more esoteric and specialized parts of the language in endof-chapter sections labeled C++ Postscript. We focus on using C++ to write practical programs based on sound design techniques, rather than on tricks and surprises in C++.

About This Book

This book includes

  • Examples and exercises that cover a wide range of applications.

  • Motivating real-world applications.

  • A broad variety of programming exercises. The book contains over 100 programming exercises.

  • End-of-chapter lists of common programming errors.

  • Coverage of STL (the Standard Template Library) (Chapter 7).

  • Discussion of the standard C++ input/output class library (Chapter 8).

  • Coverage of object-oriented programming in the Microsoft Foundation Classes (Chapter 9).

  • Exercises at the ends of sections so that readers can check their mastery of the sections. The book contains over 500 such exercises. Answers to the odd-numbered section exercises are given in the back of the book, and answers to the even-numbered section exercises are given in the Instructor's Guide.

  • Figures to facilitate the learning process.

  • The latest changes and additions to the C++ language.

  • Major data structures, including stacks (Sections 3.2 and 7.2) and files (Section 8.6), implemented in C++.

  • Understandable code. We have opted for clarity rather than subterfuges based on obscure C++ features.

  • Microsoft's Visual C++ student compiler.

Changes from the First Edition

  • Recent changes and additions to C++ are incorporated throughout the book.

  • Namespaces are introduced earlier (Section 2.1) because namespace std is needed for the newstyle headers.

  • Exception handling is also introduced earlier (Section 2.8).

  • An entire chapter is devoted to polymorphism (Chapter 5).

  • Inheritance (Chapter 4) and polymorphism (Chapter 5) are introduced earlier to underscore their importance to the object-oriented programming paradigm. Operator overloading therefore comes later (Chapter 6).

  • Run-time type identification is integrated into the main body of the text (Section 5.5).

  • An entire chapter (Chapter 7) is devoted to templates and the standard template library.

  • Chapter 8 (Chapter 7 in the first edition) on the C++ input/output class hierarchy is considerably revised to incorporate significant changes to this hierarchy.

  • Chapter 9 is added to cover object-oriented programming in the Microsoft Foundation Classes.

  • Some of the more recondite parts of the language are reserved for C++ Postscript sections at ends of chapters.

  • The number of worked examples has been increased to nearly 300.

  • The number of exercises has been increased to over 500.

  • We have extensively revised the sample applications.

  • The figures are boxed to separate them visually from the text.

  • A World Wide Web site has been established to provide up-to-date support for the book.

  • Microsoft's Visual C++ student compiler is included on a CD-ROM.

Organization of the Book

Chapter 1 introduces key concepts associated with object-oriented design and programming: classes, abstract data types, objects, encapsulation, the client/server model, message passing, inheritance, polymorphism, and others. The chapter contrasts object-oriented design with topdown functional decomposition and offers examples to illustrate the differences between the approaches.

Important changes and additions to C++ are detailed in Chapter 2. Chapter 2 also introduces namespaces, type string, the new and delete operators, exception handling, and basic C++ input/output. The reader can begin using these important C++ features right away.

Chapter 3 covers the basics of classes so that the reader can begin using classes at once. The chapter explains how to declare classes; how to write constructors, destructors, and other methods; static data members and methods; and pointers to objects. Chapter 3 relies heavily on examples to explain how classes may be used to implement abstract data types and to meet the object-oriented goal of encapsulation.

Inheritance (including multiple inheritance) is the topic of Chapter 4. Through examples and sample applications (e.g., a sequence hierarchy), the chapter illustrates basic programming techniques.

Polymorphism is covered in Chapter 5. Section 5.1 carefully explains the distinction between run-time and compile-time binding. Sections 5.4 and 5.5 explain abstract base classes and run-time type identification.

Chapter 6 is devoted to operator overloading. The chapter shows how to overload common operators (e.g., +, /) as well as the subscript, function call, memory management, preincrement, and postincrement operators among others. Many examples and sample applications highlight the power of operator overloading.

Templates and STL (standard template library) are explained in Chapter 7. A template stack class (Section 7.2) shows templates in action, and a sample application (stock performance reports in Section 7.4) demonstrates how to use STL.

Chapter 8 serves several purposes. First, the chapter examines the C++ input/output library in detail so that the interested reader can exploit the powerful classes contained therein. This treatment culminates in a sample application that builds a random access file class through inheritance from a system file class. Second, the chapter uses the input/output library as a major, sophisticated example of object-oriented design realized in C++. Third, the hierarchy provides an excellent example of the use of templates. Chapter 8 pays close attention to manipulators, which are powerful ways to do sophisticated input/output in C++. We believe that Chapter 8 offers an unrivaled examination of C++'s input/output.

Chapter 9 covers object-oriented programming in the Microsoft Foundation Classes (MFC). We clarify the relationship between MFC and the Win32 Applications Programmer Interface, Microsoft's C libraries for accessing systems services. We also introduce the basic concepts and constructs of event-driven programming. The chapter focuses on object persistence through serialization and interapplication communication under Microsoft's Common Object Model. We provide two sample applications together with an overview of MFC and Visual C++.

Two appendices are provided for reference. Appendix A contains the ASCII table. Appendix B contains a list of some of the most useful C++ functions and class methods. We describe the parameters and return values, the header to include, and what the function or method does.

We rely heavily on short examples, figures, and tables to illustrate specific points about the syntax and semantics of C++. From our experience teaching C++ and other languages, we are convinced that no single method is appropriate for clarifying every aspect about a language.

Most of our students agree with us that learning and using C++ is exciting. We have tried to incorporate this view by using engaging examples, sample applications, programming exercises, and short segments of code.

Chapter Structure

The basic chapter organization is as follows:

Contents
Overview
Section
Section Exercises
Section
Section Exercises
C++ Postscript
Common Programming Errors
Programming Exercises

In every chapter except 1 and 2, several sections are devoted to sample applications. Each of these sections contains a statement of a problem, sample input and output, a solution to the problem, and a well-documented implementation of a solution to the problem in C++. Most of these sections conclude with an extended discussion.

The sample applications include the following:

  • A stack class (Sections 3.2 and 7.2)

  • Tracking films (Sections 4.3 and 5.2)

  • A sequence hierarchy (Section 4.6)

  • A complex number class (Section 6.2)

  • An associative array (Section 6.8)

  • Stock performance reports (Section 7.4)

  • A random access file class (Section 8.6)

  • Interapplication communication under Microsoft's Common Object Model (Section9.5)

The C++ Postscript sections discuss less-used parts of the language and give additional technical details about certain parts of the language.

The Common Programming Errors sections highlight those aspects of the language that are easily misunderstood.

The book contains over 100 programming exercises drawn from a wide variety of applications.

Examples

The book contains nearly 300 examples, which clarify particular facets of C++ for the reader and show the purpose of various C++ features. A box marks the end of each example.

Exercises

The book contains over 500 section review exercises, the answers to which are short answers, code segments, and, in a few cases, entire programs. These exercises are suitable as homework problems or as self-tests. The answers to the odd-numbered exercises are given in the back of the book, and the answers to the even-numbered exercises are given in the Instructor's Guide. Our experience in teaching C++ has convinced us of the importance of these exercises.

The applications covered in the programming exercises at the ends of the chapters include the following:

  • Simulation (Programming Exercise 2.9)

  • Queues (Programming Exercises 3.8 and 7.4)

  • Process synchronization (Programming Exercise 3.10)

  • Databases (Programming Exercise 3.15)

  • Local area networks (Programming Exercises 3.17 and 6.7)

  • Array hierarchy (Programming Exercise 4.4)

  • Dating services (Programming Exercise 5.10)

  • Iterators (Programming Exercises 7.6, 7.7, and 7.8)

  • Scheduling (Programming Exercise 7.14)

  • An indexed file class (Programming Exercise 8.5)

  • A dialog-based application with a graphical-user interface for a system administrator (Programming Exercise 9.9)

Not every reader will be interested in all of these applications; however, we think that it is important to show the variety of problems that C++ can address.

CD-ROM

The book comes with a CD-ROM that has the Student Edition of the current release of Microsoft's Visual C++ Integrated Development Environment, which includes a C++ compiler, a debugger and class browser, help facilities, the Microsoft Foundation Classes and the ActiveX Template Library, and many other resources for applications development. All of our sample applications, including the Microsoft-specific applications of Chapter 9, may be compiled and run under Visual C++.

Instructor Supplement

An Instructor's Guide is available from the publisher at no cost to adopters of this book. The Instructor's Guide contains solutions to even-numbered section exercises, sample syllabi, and transparency masters.

World Wide Web Site

The World Wide Web site

http://condor.depaul.edu/-mkalin

contains the source code, header files, and data files for all of the book's sample applications; the source code for some of the longer examples; sample syllabi; transparencies; a sample chapter; information about using Microsoft Visual C++; additional technical details about the Microsoft Foundation Classes; and an errata list.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020