C++ TUTORIAL - TABLE OF CONTENTS Introduction Page I-1 Chapter 1 - Simple Things Page 1-1 CONCOM.CPP Constants and comments 1-1 SCOPEOP.CPP Scope operator 1-3 MESSAGE.CPP The stream library 1-3 FSTREAM.CPP File streams 1-5 VARDEF.CPP Variable definitions 1-6 Chapter 2 - Compound Types Page 2-1 ENUM.CPP The enumerated type 2-1 STRUCTUR.CPP The structure 2-1 CLASS1.CPP The class 2-2 UNIONEX.CPP The union 2-3 TYPECONV.CPP Type conversions 2-3 Chapter 3 - Pointers Page 3-1 POINTERS.CPP Using Pointers 3-1 NEWDEL.CPP New and delete operators 3-2 FUNCPNT.CPP Function pointers 3-4 Chapter 4 - Functions Page 4-1 PROTYPE1.CPP Using prototypes 4-1 PROTYPE2.CPP Using prototypes 4-3 PASSREF.CPP Pass by reference 4-4 DEFAULT.CPP Parameter defaults 4-5 VARARGS.CPP Variable number of arguments 4-6 OVERLOAD.CPP Overloading function names 4-7 Chapter 5 - Encapsulation Page 5-1 OPEN.CPP No information hiding 5-1 CLAS.CPP Information hiding 5-2 OPENPOLE.CPP Corruptible data 5-6 CLASPOLE.CPP Protected data 5-7 CONSPOLE.CPP Constructors and destructors 5-9 BOXES1.CPP All in one file 5-10 BOX.H Box interface 5-11 BOX.CPP Box implementation 5-11 BOXES2.CPP Using the box class 5-12 DATE.H The date class header 5-15 DATE.CPP The date implementation 5-15 USEDATE.CPP Using the date class 5-16 Chapter 6 - More encapsulation Page 6-1 OBJARRAY.CPP An Array of objects 6-1 OBJSTRNG.CPP An object with a string 6-3 OBJINTPT.CPP An object with a pointer 6-3 OBJDYNAM.CPP Dynamic allocation of objects 6-5 OBJLIST.CPP Embedded pointers 6-5 OBJLINK.CPP Linked list of objects 6-7 NESTING.CPP Nested classes 6-8 OPOVERLD.CPP Operator overloading 6-9 FUNCOVER.CPP Function name overloading 6-11 Chapter 6 - More encapsulation (Continued) Page 6-1 TIME.H The time class header 6-12 TIME.CPP The time implementation 6-12 USETIME.CPP Using the time class 6-12 Chapter 7 - Inheritance Page 7-1 VEHICLE.H Vehicle interface 7-1 VEHICLE.CPP Vehicle implementation 7-2 TRANSPRT.CPP Using the vehicle class 7-2 CAR.H Car interface 7-3 CAR.CPP Car implementation 7-4 TRUCK.H Truck interface 7-5 TRUCK.CPP Truck implementation 7-5 ALLVEHIC.CPP Use of car, truck, & vehicle 7-5 NEWDATE.H The newdate class header 7-7 NEWDATE.CPP The newdate implementaion 7-7 TRYNDATE.CPP Using the newdate class 7-8 Chapter 8 - More inheritance Page 8-1 INHERIT1.CPP Using public 8-1 INHERIT2.CPP Omitting public 8-2 INHERIT3.CPP Intra class messages 8-3 INHERIT4.CPP Without protected 8-4 INHERIT5.CPP Using protected 8-5 INHERIT6.CPP Using Constructors 8-5 INHERIT7.CPP Arrays and pointers 8-6 Chapter 9 - Multiple Inheritance Page 9-1 MULTINH1.CPP Multiple inheritance 9-2 MULTINH2.CPP Duplicate method names 9-3 MULTINH3.CPP Duplicate variable names 9-4 DATETIME.H Datetime class header 9-4 USEDTTM.CPP Using the datetime class 9-6 TEMPLAT1.CPP Simple template example 9-7 TEMPLAT2.CPP Strings template example 9-7 TEMPLAT3.CPP Class template example 9-8 VIRTUAL1.CPP The starting point 10-1 VIRTUAL2.CPP Adding virtual 10-2 VIRTUAL3.CPP Using pointers to subclasses 10-3 VIRTUAL4.CPP Using virtual 10-3 VIRTUAL5.CPP Using pointers to parent class 10-4 VIRTUAL6.CPP True virtual functions 10-5 PERSON.H Person header 11-1 PERSON.CPP Person implementation 11-2 SUPERVSR.H Personnel header 11-2 SUPERVSR.CPP Personnel implementation 11-2 EMPLOYEE.CPP A simple user program 11-3 ELEMLIST.H Linked list header 11-4 ELEMLIST.CPP Linked list implementation 11-5 EMPLOYE2.CPP A better user program 11-5 FLYAWAY.EXE Flyaway executable 12-1 FLYAWAY.H Global definitions 12-3 CLOCK.H Clock header 12-3 CLOCK.CPP Clock implementation 12-3 WORDS.H Command parsing header 12-4 WORDS.CPP Command parsing code 12-4 ITEMS.H Moveable items header 12-4 ITEMS.CPP Items implementation 12-4 SCHEDULE.H Scheduler header 12-5 SCHEDULE.CPP Scheduler implementation 12-5 LOCATION.H Locations header 12-6 LOCATION.CPP Locations implementation 12-6 MESSAGE.TXT String messages 12-7 FLYAWAY.CPP Main program 12-7 MAP.H Airport map header 12-8 MAP.CPP Airport map implementation 12-8 ABOUT THE AUTHOR _________________________________________________________________ The author of this tutorial began programming in 1961 using FORTRAN on an IBM 1620. Since then, most of his career has been involved with designing digital logic for satellite application. In 1983, being somewhat burned out with logic design, he began a study of some of the more modern programming languages and has since made a complete career shift to software development. After learning Pascal, C was studied, followed by Modula-2 and Ada, and more recently C++. Rather than simply learning the syntax of each new language, modern methods of software engineering were studied and applied to effectively utilize the languages. He is currently employed by a large research and development laboratory where he continues to study, teach, and apply the newer programming languages.