C++ Primer Plus is a carefully crafted, complete tutorial on one of the most significant and widely used programming languages today. An accessible and easy-to-use self-study guide, this book is appropriate for both serious students of programming as well as developers already proficient in other languages.The sixth edition of C++ Primer Plus has been updated and expanded to cover the latest developments in C++, including a detailed look at the new C++11 standard.Author and educator Stephen Prata has created an introduction to C++ that is instructive, clear, and insightful. Fundamental programming concepts are explained along with details of the C++ language. Many short, practical examples illustrate just one or two concepts at a time, encouraging readers to master new topics by immediately putting them to use.Review questions and programming exercises at the end of each chapter help readers zero in on the most critical information and digest the most difficult concepts.In C++ Primer Plus, you'll find depth, breadth, and a variety of teaching techniques and tools to enhance your learning:• A new detailed chapter on the changes and additional capabilities introduced in the C++11 standard• Complete, integrated discussion of both basic C language and additional C++ features• Clear guidance about when and why to use a feature• Hands-on learning with concise and simple examples that develop your understanding a concept or two at a time• Hundreds of practical sample programs• Review questions and programming exercises at the end of each chapter to test your understanding• Coverage of generic C++ gives you the greatest possible flexibility• Teaches the ISO standard, including discussions of templates, the Standard Template Library, the string class, exceptions, RTTI, and namespaces
Программирование, программы, базы данных18+Developer’s Library
ESSENTIAL REFERENCES FOR PROGRAMMING PROFESSIONALS
All books in the
Key titles include some of the best, most widely acclaimed books within their topic areas:
Luke Welling & Laura Thomson
ISBN-13: 978-0-672-32916-6
Paul DuBois
ISBN-13: 978-0-672-32938-8
Robert Love
ISBN-13: 978-0-672-32946-3
David Beazley
ISBN-13: 978-0-672-32862-6
Korry Douglas
ISBN-13: 978-0-672-32756-8
Stephen Prata
ISBN-13: 978-0-321-77640-2
Developer’s Library books are available at most retail and online bookstores, as well as by subscription from Safari Books Online at safari.informit.com.
Developer’s Library
informit.com/devlibrary
C++ Primer Plus, Sixth Edition
Stephen Prata
Upper Saddle River, NJ • Boston • Indianapolis • San Francisco
New York • Toronto • Montreal • London • Munich • Paris • Madrid
Cape Town • Sydney • Tokyo • Singapore • Mexico City
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact:
U.S. Corporate and Government Sales
(800) 382-3419
For sales outside the United States, please contact:
International Sales
Visit us on the Web: informit.com/aw.
Copyright © 2012 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-321-77640-2
ISBN-10: 0-321-77640-2
Text printed in the United States on recycled paper at R.R. Donnelley in Crawfordsville, Indiana.
First printing: October 2011
Acquisitions Editor
Mark Taber
Development Editor
Michael Thurston
Managing Editor
Kristy Hart
Project Editors
Samantha Sinkhorn
Jovana Shirley
Copy Editor
Bart Reed
Indexer
Lisa Stumpf
Proofreader
Language Logistics, LLC
Technical Reviewer
David Horvath
Publishing Coordinator
Vanessa Evans
Cover Designer
Gary Adair
Compositor
Nonie Ratcliff
Contents at a Glance
Introduction
1 Getting Started with C++
2 Setting Out to C++
3 Dealing with Data
4 Compound Types
5 Loops and Relational Expressions
6 Branching Statements and Logical Operators
7 Functions: C++’s Programming Modules
8 Adventures in Functions
9 Memory Models and Namespaces
10 Objects and Classes
11 Working with Classes