Developers: Learn a New Programming Language or App Development with Deitel LiveLessons Videos!
Login  |  Register  |  Media Kit  |  Press  |  Contact Us  |   Twitter Become a Deitel Fan on Facebook  
Custom Search

Visual C   2008 How to Program, 2/e Cover

ISBN: 0136151574
© 2008, pp. 1500

Order now at

Download Code
Examples and
Other Premium
Content for
Registered Users

Login or Register to download this book's code examples and other premium content.

Additional Resources

Visual C 2008 How to Program, 2/e
Available Now!

Order from
From the Preface
Here’s a list of updates we’ve made to the second edition of Visual C++ How to Program:
  • New Native-Code Approach. Microsoft has determined that most Visual C++ developers do the majority of their programming in native C++. As a result, this edition of the book represents a major overhaul in approach from the first edition. We now introduce new programming concepts first with native C++ followed by accompanying managed code sections with C++/CLI where appropriate. We worked closely with various members of the Visual C++ team during all phases of writing and determined that this was the best course for the new edition of this book.
  • Major Content Revisions and Updates for the .NET Framework. All the chapters have been significantly updated and upgraded. All new sections and chapters introducing managed code concepts with C++/CLI have been added. We tuned the writing for clarity and precision. We also adjusted our use of Visual C++ terminology in accordance with the ISO/IEC C++ standard document that defines the language.
  • Introduction to Visual C++ Express 2008 IDE and Debugger. Chapter 2 provides a detailed tutorial on using the Visual C++ Express 2008 Integrated Development Environment to create and run new native C++ and .NET projects. Appendix I, Using the Visual Studio Debugger explains the basics of debugging programs using Visual C++ Express 2008.
  • The Managed Heap and CLR Garbage Collector. Chapters 9 and 11 include all new sections on the managed heap, the CLR garbage collector, and memory management in .NET. We introduce handles and tracking references for using managed objects with C++/CLI.
  • New Content on the .NET Framework Class Library (FCL). New sections introducing managed code concepts with C++/CLI use numerous classes from the .NET Framework Class Library. Chapter 18 teaches file processing in .NET using the File and Directory classes. Chapter 19 provides an in-depth look at classes String, StringBuilder and Char. Chapter 24 focuses exclusively on collections in the .NET Framework using FCL classes.
  • Exception Handling in .NET. After introducing exception handling in native C++. Chapter 16 introduces the .NET Exception class hierarchy. We demonstrate the use of finally and stack semantics for writing safer code with C++/CLI.
  • Templates and Generics. Templates have always been a powerful feature of native C++. New sections in Chapter 15 introduce managed templates in C++/CLI as well as .NET Generics. We compare and contrast the strengths and weaknesses of both types of generic programming.
  • Early Classes and Objects Approach. Students are introduced to the basic concepts and terminology of object technology in Chapter 1 and begin developing customized, reusable classes and objects in Chapter 4 using native C++ and managed code with C++/CLI. This book presents object-oriented programming, where appropriate, from the start and throughout the text. The early discussion of objects and classes gets students “thinking about objects” immediately and mastering these concepts more completely. Object-oriented programming is not trivial by any means, but it’s fun to write object-oriented programs, and students can see immediate results.
  • Integrated Case Studies. We provide several case studies spanning multiple sections and chapters that often build on a class introduced earlier in the book to demonstrate new programming concepts later in the book. These case studies include the development of the GradeBook class in Chapters 4–8, the Time class in several sections of Chapters 10–11, the Employee class in Chapters 13–14, and the optional OOD/UML ATM case study in Chapters 1–8, 10, 14 and Appendix G.
  • Integrated GradeBook Case Study. The GradeBook case study reinforces our early classes presentation. It uses classes and objects in Chapters 4–8 to incrementally build a GradeBook class that represents an instructor’s grade book and performs various calculations based on a set of student grades, such as calculating the average grade, finding the maximum and minimum, and printing a bar chart.
  • Unified Modeling Language™ 2 (UML 2). The Unified Modeling Language (UML) has become the preferred graphical modeling language for designers of object-oriented systems. All the UML diagrams in the book comply with the UML 2 specification. We use UML class diagrams to visually represent classes and their inheritance relationships, and we use UML activity diagrams to demonstrate the flow of control in each of Visual C ’s control statements. We make especially heavy use of the UML in the optional OOD/UML ATM case study
  • Optional OOD/UML ATM Case Study. The optional OOD/UML automated teller machine (ATM) case study in the Software Engineering Case Study sections of Chapters 1–8, 10 and 14 is appropriate for first and second programming courses. The nine case study sections present a carefully paced introduction to object-oriented design using the UML. We introduce a concise, simplified subset of the UML 2, then guide you through a first design experience intended for the novice object-oriented designer/programmer. Our goal in this case study is to help students develop an object-oriented design to complement the object-oriented programming concepts they begin learning in Chapter 1 and implementing in Chapter 4. The case study was reviewed by a distinguished team of OOD/UML academic and industry professionals. The case study is not an exercise; rather, it is a fully developed end-to-end learning experience that concludes with a detailed walkthrough of the complete 877-line Visual C++ code implementation. We take a detailed tour of the nine sections of this case study later in the Preface.
  • Compilation and Linking Process for Multiple-Source-File Programs. Chapter 4 includes a detailed diagram and discussion of the compilation and linking process that produces an executable application.
  • Function Call Stack Explanation. In Chapter 7, we provide a detailed discussion (with illustrations) of the function call stack and activation records to explain how Visual C++ is able to keep track of which function is currently executing, how automatic variables of functions are maintained in memory and how a function knows where to return after it completes execution.
  • C Standard Library string and vector Classes. The string and vector classes are used to make earlier examples more object-oriented.
  • Class string. We use class string instead of C-like pointer-based char * strings for most string manipulations throughout the book. We continue to include discussions of char * strings in Chapters 9, 11, 12 and 22 to give students practice with pointer manipulations, to illustrate dynamic memory allocation with new and delete, to build our own String class, and to prepare students for working with char * strings in C and C++ legacy code.
  • Class Template vector. We use class template vector instead of C-like pointer-based array manipulations throughout the book. However, we begin by discussing C-like pointer-based arrays in Chapter 8 to prepare students for working with C and C++ legacy code and to use as a basis for building our own customized Array class in Chapter 12, Operator Overloading; String and Array Objects.
  • Tuned Treatment of Inheritance and Polymorphism. Chapters 13–14 have been carefully tuned using an Employee class hierarchy to make the treatment of inheritance and polymorphism clearer and more accessible for students who are new to OOP.
  • Discussion and Illustration of How Polymorphism Works “Under the Hood.” Chapter 14 contains a detailed diagram and explanation of how Visual C++ can implement polymorphism, virtual functions and dynamic binding internally. This gives students a solid understanding of how these capabilities really work. More importantly, it helps students appreciate the overhead of polymorphism—in terms of additional memory consumption and processor time. This helps students determine when to use polymorphism and when to avoid it.
  • Standard Template Library (STL). This might be one of the most important topics in the book in terms of your appreciation of software reuse. The STL defines powerful, template-based, reusable components that implement many common data structures and algorithms used to process those data structures. Chapter 23 introduces the STL and discusses its three key components—containers, iterators and algorithms. We show that using STL components provides tremendous expressive power, often reducing many lines of code to a single statement. We also introduce the STL/CLR, a new Microsoft library enabling managed code with C++/CLI to leverage the power of STL containers and algorithms.
  • Debugger Appendices. We include an appendix on debugging, Appendix I, Using the Visual Studio Debugger.
All of this has been carefully reviewed by distinguished academics and industry developers who worked with us on previous editions of C++ How to Program and Visual C++ How to Program.


“Great book for learning how to use Visual C++ 2008 in building Microsoft Windows applications. Great introduction to the Visual Studio 2008 IDE. I like the instruction of native heap management followed by gcnew. Good job covering the differences between templates and generics.” –Mykola Dudar, Microsoft.

“One of the BEST C++ texts I’ve seen! A fine tool for learning and reference. One of the more thorough sections on classic arrays and pointers. Nice explanation of how vtables work to implement polymorphism. Solid chapter on exceptions. The string processing exercises are fun. Coverage of Big O is a big plus for this book. I like your graphical explanation of linked lists. The Simpletron exercise looks very exciting. I particularly appreciate the discussions of the underlying implementation of various STL containers that help the reader choose one container over another.” –Ronald DiNapoli, Cornell University

“An excellent job of introducing students to the C++ language and modern software engineering practices. The authors have also included information on programming in C++/CLI, the version of C++ for managed programming.” –Gordon Hogenson, Microsoft and author of C++/CLI: The Visual C++ Language for .NET

“A comprehensive introduction to Microsoft’s implementation of the C++ programming language. The ATM case study represents a great end-to-end example of the process of software design and implementation using UML. Readers will become comfortable in the managed and interop worlds, using C++/CLI. Well-structured introduction to recursion. Nice evolutionary approach demonstrating the value of inheritance in the Employee hierarchy. Comprehensive section on generics. Terminology in the CLI chapters is very .NET.” –Vytautas Leonavicius, Microsoft

“The possibilities for Visual C++ and C++/CLI are endless, so it would seem a daunting task to present these powerful languages in a fashion suited for beginning and intermediate C++ programmers. This text has the right topic mix and flow of learning for programmers of all levels. The continuous use of examples and exercises, and the OOD/UML ATM case study ensure that readers can immediately begin writing solid programs.” –April Reagan, Microsoft

“Exercises on Knight’s Tour and Eight Queens give a strong visual feeling of two-dimensional arrays. The Searching and Sorting chapter can supplement data structures courses. Exercises on binary trees and stacks with reverse Polish notation are commendable. Regular expression exercises are great.” –Tim H. Lin, Cal. State Poly., Pomona

“Creates the mindset needed to tackle and programming challenge with full power of the C++ language, and educates you in C++/CLI, language extensions for the Microsoft .NET Platform. I like the special attention you give to code readability. Case studies do a great job teaching design skills. Good introductions to OOP, data structures, compilers [in the exercise] and collections in .NET.” –Alvin Chardon, Microsoft


Deitel Dive-Into(R) Series Corporate Training

Discounts on subscriptions

Update :: January 18, 2017