C++ Programming for Programmers using Microsoft Visual C++ 6.0 Professional Compiled and Presented by Thomas P. Sturm, Ph.D. Graduate Programs in Software Technical Seminar The University of St. Thomas St. Paul, Minnesota
Copyright 1992-2000 Thomas P. Sturm All rights reserved. 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, or otherwise, or translated into any language, without prior written permission of the author. Microsoft, MS-DOS, Windows, Visual C++, and MSDN are registered trademarks of Microsoft Corporation IBM is a registered trademark of International Business Machines Corporation Turbo C, Turbo C++, Borland C++, and Sidekick are registered trademarks of Borland International, Inc. UNIX is a registered trademark of American Telephone and Telegraph Company VAX, DEC, VMS, VAX C, and VAX C++ are registered trademarks of Digital Equipment Corporation References to K&R refer to Kernighan, Brian W. and Ritchie, Dennis M. The C Programming Language, 2 nd edition. Englewood Cliffs, New Jersey: Prentice-Hall, Inc. 1988. References to Ladd refer to Ladd, Scott Robert. Turbo C++: Techniques and Applications. Redwood City, California: M&T Books. 1990. References to Lippman refer to Lippman, Stanley B. C++ Primer. Reading, Massachusetts: Addison-Wesley Publishing Co. 1990. References to Stroustrup refer to Stroustrup, Bjarne. The C++ Programming Language, 3 rd edition. Reading Massachusetts: Addison-Wesley Publishing Co. 1997. References to Deitel refer to Deitel, H.M. and Deitel, P.J. C++: How to Program, 2 nd edition. Upper Saddle River, Prentice-Hall, Inc. 1998. Preface ii C++ Programming
C++ Programming for Programmers using Microsoft Visual C++ 6.0 Professional The goal of this seminar is to get experienced programmers started in programming using the C++ language, having no exposure to the C or C++ programming languages. Objectives: By the end of the course, qualified and diligent participants will be able to: 1. Understand the philosophy of C++ 2. Write short programs and supporting functions in C++ 3. Understand good/safe/defensive programming procedures as they pertain to C++ 4. Read and modify existing well-written C++ programs 5. Understand the object-oriented features that are provided by C++ 6. Understand the concepts of overloading, inheritance, and polymorphism During the seminar, participants will be given opportunity to: 1. Write stream processing functions 2. Use common library functions 3. Write numeric processing functions 4. Create and use object classes in C++ 5. Overload functions and operators in C++ 6. Write functions that input/output to terminal and files C++ Programming iii Preface
C++ Programming Outline Tuesday Jan. 4 - Introduction C++ / Features of C++ o Introduction and justification o Microsoft Visual C++ development environment o Object-oriented programming o Tutorial overview of C++ language features Thursday Jan. 6 - C++ Language Details o Error checking o Functions o Scope, storage, initialization o Operators and language statements Tuesday Jan. 11 - Pointers and Built-In Objects in C++ o Pointers o Built in objects and functions o Overloading functions and operators Thursday Jan. 13 - Classes and Objects o Class definition o Overloading class operators o Overloading class functions o Constructors and destructors Preface iv C++ Programming
Tuesday Jan. 18 - Interaction between Classes o Friends o Templates o Inheritance o Polymorphism Thursday Jan. 20 - Input/Output o Stream Input/Output o File I/O Tuesday Jan. 25 - Advanced Features o Templates o Multiple Inheritance o Exception Handling C++ Programming v Preface
Participant Introductions 1. Name 2. Company and Department 3. Experience in procedural programming (languages known) 4. Intended applications of C++ 5. Most likely computer and C++ compiler to be used Preface vi C++ Programming
Suggested Daily Schedule 6:00 P.M. One-Minute Summaries / Jeopardy / Lecture Module 7:10 P.M. Break and Lab 7:50 P.M. Lecture Module 8:59 P.M. One-minute paper C++ Programming vii Preface
Table of Contents 1. Language Overview 2. Features of C++ 3. Functions, Pointers, and Arrays 4. Classes and Objects 5. Interaction between Classes 6. Input and Output 7. Advanced Features and Class Libraries 8. Exercises 9. Function Reference 10. Operating System Environments 11. Index and References Preface viii C++ Programming
C++ Programming ix Preface