C++ All-in-One For Dummies, 2nd Edition
by John Paul Mueller and Jeff Cogswell
C++ All-in-One For Dummies, 2nd Edition
Published by
Wiley Publishing, Inc.
111 River St.
Hoboken, NJ 07030-5774
www.wiley.com
Copyright 2009 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
For technical support, please visit www.wiley.com/techsupport.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Library of Congress Control Number: 2009932710
ISBN: 978-0-470-31735-8
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
About the Authors
John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 83 books and over 300 articles to date. The topics range from networking to artificial intelligence and from database management to heads-down programming. Some of his current books include a C# design and development guide and a complete reference for LINQ. John also writes about areas other than programming, such as Exchange Server. His technical editing skills have helped more than 63 authors refine the content of their manuscripts. John has provided technical editing services to both Data Based Advisor and Coast Compute magazines. Hes also contributed articles to the following magazines: CIO.com, DevSource, InformIT, Informant, DevX, SQL Server Professional, Visual C++ Developer, Hard Core Visual Basic, asp.netPRO, Software Test and Performance, and Visual Basic Developer.
When John isnt working at the computer, he enjoys spending time in his workshop crafting wood projects or making candles. On any given afternoon, you can find him working at a lathe or putting the finishing touches on a bookcase. He also likes making glycerin soap, which comes in handy for gift baskets. You can reach John on the Internet at JMueller@mwt.net. John is also setting up a Web site and blog at http://www.johnmuellerbooks.com/. Feel free to look and make suggestions on how he can improve it.
Jeff Cogswell is an experienced teacher, writer, and software engineer. He worked 15 years as a professional programmer and software engineer before leaving that field to write and edit full time. He is currently a senior editor with Ziff Davis Enterprise, writing and editing for DevSource.com and eWEEK.com. His skills include C++ as well as several other languages and platforms, such as C# and ASP.NET. In his spare time he enjoys traveling, playing the guitar, and photography.
Dedication
This book is dedicated to Dr. Michael Shonfeld and Nurse Barb McPherson, two special people who may not always get the thanks they deserve. Thank you so much for your help in returning my beautiful wife to me!
John Paul Mueller
To my wife Angie, and my son Dylan, with love.
Jeff Cogswell
Authors Acknowledgments
I really appreciate Jeff having the confidence to work with me on this book. Weve known each other for quite some time now and I always enjoy working with him.
Russ Mullen deserves thanks for his technical edit of this book. He added greatly to the accuracy and depth of the material that you see here. I appreciated the time he devoted to checking my code for accuracy. As I wrote this book, I also spent a good deal of time bouncing ideas off Russ, who is a valuable aid to any author.
Matt Wagner, my agent, deserves credit for helping me get the contract in the first place and taking care of all the details that most authors dont consider. I always appreciate his assistance. Its good to know that someone wants to help. Matt also helped me through an extremely difficult time in my life this book is a tribute to the perseverance of us both.
A number of people read all or part of this book to help me refine the approach, test the examples, and generally provide input that every reader wishes they could have. These unpaid volunteers helped in ways too numerous to mention here. I especially appreciate the efforts of Eva Beattie, Osvaldo Tllez Almirall, and all the others who provided input on C++. I'd like to thank each person who wrote me with an idea by name, but there are simply too many.
Finally, I would like to thank Katie Feltman, Susan Pink, Blair Pottenger, and the rest of the editorial and production staff for their assistance in bringing this book to print. Its always nice to work with such a great group of professionals.
John Paul Mueller
I first want to thank John Mueller for taking up such a difficult task and writing the second edition of this book, as well as his wife, Rebecca, for staying strong. Also, another book brings another big thanks to my agent and friend, Margot Hutchison, for the usual great work. And special thanks to Katie Feltman and editors Susan Pink and Blair Pottenger for their meticulous work in making this project reality. Finally, thanks to my wife Angie and my son Dylan for supporting me in all my projects.