
Learning to Program in C++
Steve Heller(Author)
Prentice Hall (Publisher)
Published on 6. December 2000
Book
Mixed media product
1120 pages
978-0-13-032410-8 (ISBN)
Description
For introductory courses in C++.
There are dozens of introductory C++ books on the market, but few of them are effective in training the complete novice, as they make too many assumptions of prior knowledge. Unlike other introductory C++ books, this book was developed with the assistance of a complete novice to the language. Her comments are questions were incorporated in the text to assist readers who have had no previous experience with programming.
Many readers, whether taking formal C++ course or studying on their own, report that the approach this book takes is far superior to any other they have encountered. A number of customer comments on Amazon.com also testify to its effectiveness.
There are dozens of introductory C++ books on the market, but few of them are effective in training the complete novice, as they make too many assumptions of prior knowledge. Unlike other introductory C++ books, this book was developed with the assistance of a complete novice to the language. Her comments are questions were incorporated in the text to assist readers who have had no previous experience with programming.
Many readers, whether taking formal C++ course or studying on their own, report that the approach this book takes is far superior to any other they have encountered. A number of customer comments on Amazon.com also testify to its effectiveness.
More details
Language
English
Place of publication
Upper Saddle River
United States
Publishing group
Pearson Education (US)
Target group
College/higher education
Dimensions
Height: 235 mm
Width: 235 mm
Thickness: 40 mm
Weight
1571 gr
ISBN-13
978-0-13-032410-8 (9780130324108)
Copyright in bibliographic data and cover images is held by Nielsen Book Services Limited or by the publishers or by their respective licensors: all rights reserved.
Schweitzer Classification
Person
STEVE HELLER, President of Chrysalis Software Corporation, is a developer based in Sulphur Springs, Texas. His books include The C++ Training Guide, The Java Training Guide, Introduction to C++, Optimizing C++, Efficient C/C++, and Who's Afraid of Java?
Content
Foreword.
Preface.
Acknowledgements.
Letter from a Novice.
1. Introduction to Programming.
Definitions. How to Write a Program. Baby Steps. On with the Show.
2. Hardware Fundamentals.
Definitions. Objectives of This Chapter. Behind the Curtain. Disk. 1985: A Space Odyssey. RAM. Return to Sender, Address Unknown. The CPU. RAM vs CPU Speeds. A Memory Hierarchy. Caching In. Please Register Here. Odometer Trouble. The First Few Numbers. The Next Few Numbers. How Many Combinations? Back to the Future. Over-Hexed. Binary to Hex Conversion Table. Different Representations of the Same Numbers. Exercises. Registering Relief. 32 and 16 Bit Registers, before Add Ax,1. 32 and 16 Bit Registers, after Add Ax,1. 32 and 16 Bit Registers, after Add Eax,1. On a RAMpage. Registering Bewilderment. 32- and 16-Bit Register Codes. Slimming the Program. A Fetching Tale. Instruction Execution Time, Using Registers and Prefetching. Review. Conclusion. Answers to Exercises.
3. Basics of Programming.
Definitions. Objectives of This Chapter. Speed Demon. Blaming It on the Computer. That Does Not Compute. Lost in Translation. A Little Numeric Calculation. What's Going on Underneath? A Small Section of RAM. Who's on First? One Little Endian. A Big Endian Example. Exercises, First Set. Exercise 1. Underware? A Really Little Numeric Calculation. Compiling, Part 3. Execution Is Everything. A Cast of Characters. Some Real Characters and Strings (Code\Basic00.Cc). Yet Another Small Section of RAM. A Byte by Any Other Name. Some Strings Attached. Special Characters for Program Text. Exercises, Second Set. A Small Section of RAM. In and Out. Some Simple Output (Code\Basic01.Cc). Some Simple Input and Output (Code\Basic02.Cc). If Only You Knew. Using an If Statement (Code\Basic03.Cc). While We're on the Subject. Using a While Statement (Code\Basic04.Cc). Exercises, Third Set. Just Up the Block. At the Fair. A C++ Program (Code\Pump1.Cc). Novice Alert. Take It for a Spin. Exercises, Fourth Set. Review. Conclusion. Answers to Exercises. First Dinner Party Program (Code\Basic05.Cc). Second Dinner Party Program (Code\Basic06.Cc). Else If Example. Name and Age Program (Code\Basic07.Cc). Novice Program (Code\Basic08.Cc). Allowance Program (Code\Basic09.Cc).
4. More Basics.
Objectives of This Chapter. Algorithmic Thinking. Finding the Top Two Weights, First Try (Code\Pump1a.Cc). A Prize Catch. Susan's Solution to the Bug in the First Attempt. Using an If Statement with an Else Clause. Finding the Top Two Weights (Code\Pump2.Cc). What A Tangled Web We Weave. You May Already Have Won. Variables, By The Numbers. Using A Vector (Code\Vect1.Cc). Zero Isn't Nothing. Index Variables. Using A For Statement (From Code\Vect1.Cc). Sorting The Weights (From Code\Vect1.Cc). Elements Vs Values. Details, Details. Initial Situation. After The First Pass. After The Second Pass. Final Situation. To Err Is Human. A Possible Error Message. Sorting The Weights, Again (From Code\Vect1.Cc). Sorting The Weights, With Correct Initialization (From Code\Vect2.Cc). To Really Foul Things Up Requires A Computer. What, Me Worry? Garbage In, Garbage Out. Garbage Prevention, First Attempt (From Code\Vect2a.Cc). Finding The Top Three Weights Using Vectors (Code\Vect3.Cc). Review. Exercises. Exercise 1 (Code\Morbas00.Cc). Exercise 2 (Code\Morbas01.Cc). Conclusion. Answers To Exercises. Weight Requesting Program, First Try (Code\Morbas02.Cc). Error Messages From The Erroneous Weight Program (Code\Morbas02.Cc). The Corrected Weight Program (Code\Morbas03.Cc). The Weight Totaling Program (Code\Morbas04.Cc).
5. Functional Literacy.
Definitions. Objectives of This Chapter. Functioning Normally. A Sample Program with Duplicated Code (Code\Nofunc.Cc). A Function Call. Above Average. A Function to Average Two Values. Return to Sender. For the Sake of Argument. Argument Passing with One Argument (Code\Birthday.Cc). General Delivery. Using a Function. Using the Average Function (Code\Func1.Cc). A Convincing Argument. The Man Behind the Curtain. The Object of My Affections. Making an Executable. Operating Systematically. Using Your Library Card. Automatic Pilot. Stacking the Deck. A Stack with One Entry. A Stack with Two Entries. A Stack with Three Entries. Don't Call Me, I'll Call You. How It All Stacks Up. An Empty Stack. The Stack Immediately after the Call to Average. The Stack after Auto Variable Allocation. Scoped Out. Scope Vs Storage Class. Static Cling. Using an Auto Variable and Initializing It (Code\Count1.Cc). Using an Auto Variable and Not Initializing It (Code\Count2.Cc). Using a Local Static Variable and Initializing It (Code\Count3.Cc). Using a Local Static Variable and Not Initializing It (Code\Count4.Cc). Using a Global Variable and Not Initializing It (Code\Count6.Cc). Using a Global Variable and Initializing It (Code\Count5.Cc). Using Variables of Different Scopes and Storage Classes (Code\Scopclas.Cc). The Results of Using Variables of Different Scopes and Storage Classes (Code\Scopclas.Out). Exercises, First Set. Exercise 1a (Code\Inita.Cc). Exercise 1b (Code\Initb.Cc). Exercise 1c (Code\Initc.Cc). Exercise 1d (Code\Initd.Cc). Exercise 1e (Code\Inite.Cc). Exercise 1f (Code\Initf.Cc). Think Globally? A BASIC Difficulty. I Say "Live It, Or Live with It". Nesting Instinct. The Stack after the Initialization of Result. The Stack after Exiting from Average. Review. Exercises, Second Set. Exercise 2 (Code\Calc1.Cc). Conclusion. Answers to Exercises. The Stack Immediately before the Call to Mess. Immediately before Executing the First Instruction in Mess. The Stack after Mess Has Declared the Auto Variable Xyz. The Stack after Xyz Has Been Initialized. The Stack before Counter Is Called. Immediately Upon Entry to Counter. Before Execution of the First Instruction in Counter.
6. Taking Inventory.
Definitions. Objectives Of This Chapter. Pay Some Attention To The Man Behind The Curtain. Taking Stock. The Initial Sample Program For The Stockitem Class (Code\Itemtst1.Cc). More Definitions. Common Behavior. Comparison Between Native And User-Defined Types. The Initial Interface Of The Stockitem Class (Code\Item1.H). The Default Constructor For The Stockitem Class (From Code\Item1.Cc). Another Way To Write The Default Stockitem Constructor. Go To The Head Of The Class. Shop Till You Drop. Another Constructor For The Stockitem Class (From Code\Item1.Cc). Display Member Function For The Stockitem Class (From Code\Item1.Cc). The Initial Interface Of The Stockitem Class (Code\Item1.H). The Initial Implementation Of The Stockitem Class (Code\Item1.Cc). Vectoring In. Reading And Displaying A Vector Of Stockitems (Code\Itemtst2.Cc). The Read Function For The Stockitem Class (From Code\Item2.Cc). The Second Version Of The Interface For The Stockitem Class (Code\Item2.H). References Required. Don't Fence Me In. Can I Help You? First Attempt To Update Inventory Of Stockitems (Code\Itemtst3.Cc). Access Denied. An Enhanced Interface For The Stockitem Class (Code\Item4.H). The Customer Is Always Right. Some New Functions For The Stockitem Class (From Code\Item4.Cc). Updating Stockitem Inventory (Code\Itemtst4.Cc). Next Customer, Please? Interface Of Inventory Class (Code\Invent1.H). Default Constructor For Inventory Class (From Code\Invent1.Cc). Loadinventory Function For Inventory Class (From Code\Invent1.Cc). Nothing Ventured, Nothing Gained. The Implementation Of Isnull (From Code\Item5.Cc). Finditem Function For Inventory Class (From Code\Invent1.Cc). Updateitem Function For Inventory Class (From Code\Invent1.Cc). The Implementation Of Getupc (From Code\Item5.Cc). The Implementation Of Getprice (From Code\Item5.Cc). Current Interface For Inventory Class (Code\Invent1.H). Current Implementation For Inventory Class (Code\Invent1.Cc). Current Interface For Stockitem Class (Code\Item5.H). Current Implementation For Stockitem Class (Code\Item5.Cc). Updated Inventory Application (Code\Itemtst5.Cc). Paging Rosie Scenario. Review. Exercises. Conclusion. Answers To Exercises. The Write Member Function For The Stockitem Class (From Code\Item6.Cc). The Storeinventory Member Function For The Inventory Class (From Code\Invent2.Cc). The Changes To The Application Program (From Code\Itemtst6.Cc).
7. Stringing Along.
Objectives of This Chapter. Playing out the String. The String Class Interface, Initial Version (Code\String1.H). The Initial Implementation for the String Class (Code\String1.Cc). The Default Constructor for the String Class (From Code\String1.Cc). Passing Along a Few Pointers. The Dynamic Duo, New and Delete. An Empty String in Memory. Our First Test Program for The String Class (Code\Strtst1.Cc). Caution: Construction Area. The Char* Constructor for the String Class (From Code\String1.Cc). String N During Construction. A Simple Test Program for the String Class (Code\Strtst1.Cc). Constructive Criticism? The Char* Constructor for the String Class, Again (From Code\String1.Cc). Tricky Assignment. String N in Memory. Strings N and S in Memory after Compiler-Generated =. Assignment Of Responsibility. Strings N and S in Memory after Custom =. References Required. The Declaration of Operator = For the String Class. Hello, Operator? Calling the Operator = Implementation. What Is the Meaning of This? The Assignment Operator (Operator =) For the String Class (from Code\String1.Cc). Equality Now! Please Delete Me, Let Me Go. Running on Empty. the Next Assignment. A Hypothetical Assignment Operator (Operator =) for the String Class with Explicit This. The Terminator. The Destructor for the String Class (from Code/String1.Cc). Review. Exercises. Exercise 1 (Code\Strex1.Cc). Exercise 2 (Code\Strex2.Cc). Exercise 3 (Code\Strex3.Cc). Conclusion. Answers to Exercises.
8. Down the Garden Path.
Objectives of This Chapter. For Reference Only. Call by Value ("Normal Argument") Using the Compiler-Generated Copy Constructor. Unfair Copy. Call by Reference. Our First Test Program for the String Class (Code\Strtst1.Cc). Temporary Help Wanted. Assigning a C String to a String Via String::String(Char*). Copy Cat. The String Class Interface (Code\String1.H). The Copy Constructor for the String Class. Screen Test. The String Class Interface, with Display Function (Code\String3.H). The String Class Test Program, Using the Display Function (Code\Strtst3.Cc). The String Class Implementation of the Display Function. A Character Study. Array of Hope? Dangerous Characters (Code\Dangchar.Cc). A Slippery Character. Overwrought. Reaping the Whirlwind. Private Property: Keep Out! Attempted Privacy Violation (Code\Strtst3a.Cc). Maintenance Required. Yet Another Version of the String Class Interface (Code\String4.H). The String Class Implementation of the Getlength Function (from Code\String4.Cc). Using the Getlength Function in the String Class (Code\Strtst4.Cc). First Review. a String of Wins. Sorting a Vector of Strings (Code\Strsort1.Cc). The Updated String Class Interface, Including Comparison and I/O Operators (Code\String5.H). Less Than Obvious. Down for the Count. Strings X and Y in Memory. Strings X and Y in Memory, with an Embedded Null Byte. Using Operator For Strings (Code\Strtst5x.Cc). The Implementation of Operator for Strings (from Code\String5a.Cc). For Better Or Worse? Is Our Character Less Than the Other One? (from Code\String5a.Cc). The Else Clause in the Comparison Loop (from Code\String5a.Cc). Handling the Return Value (from Code\String5a.Cc). A Greater Cause. Simple Pleasures. Implementing Operator for Strings (from Code\String5.Cc). Equalization of Opportunity. Implementing Operator == for Strings (From Code\String5.Cc). Displaying Expertise. Down by the Old Cout Stream. Chaining Several Operator << Expressions Together (Code\Cout1.Cc). Gently Down the Stream. Friends of Global Progress. An Operator << Function to Output a String (From Code\String5.Cc). Members and Friends Only. Why We Need a Global Function for Operator <<. Reader and Advisor. An Operator >> Function to Input a String (from Code\String 5.Cc). Initial Here. Error from an Uninitialized Const (Code\String5x.Out). Use of a Non-Const Array Size (Code\String5y.Cc). Trying to Compile a Program with a Non-Const Array Size (Code\String5y.Out). Pointers and Setters. Second Review. Exercises. Exercise 1 (Code\Strex5.Cc). Exercise 2 (Code\Strex6.Cc). Conclusion. Answers to Exercises. The String Class Interface File (From Code\String6.H). The String Class Implementation of Operator . The String Class Implementation of Operator =. The String Class Implementation of Operator != (from Code\String6.Cc). The String Class Implementation of Operator (from Code\String6.Cc). The Test Program for the Comparison Operators of the String Class (Code\Strcmp.cc).
9. Stocking Up.
Definitions. Objectives of This Chapter. Under Control. The Next Stockitem Header File (Code\Item20.H). The Next Implementation of Stockitem (Code\Item20.Cc). Taking Inventory. The Next Header File for the Inventory Class (Code\Invent20.H). Claiming an Inheritance. The Stockitem Test Program for the Base Stockitem Class (Code\Itmtst20.Cc). The Implementation of the Inventory Class (Code\Invent20.Cc). The Reorder Function for the Stockitem Class (from Code\Item20.Cc). A Dated Approach. Ancestor Worship. Simplified Interface for Stockitem and Datedstockitem Classes (Code\Itema.H). A Simplified Stockitem Object. A Datedstockitem Object. More Definitions. Protection Racket. A Derived Class Object with Its Base Class Part. Stock Footage. The Next Version of the Inventory Control Test Program (Code\Itmtst21.Cc). Full Interface for Stockitem and Datedstockitem (Code\Item21.H). Latest Implementation of Stockitem Class and First Implementation of Datedstockitem Class (Code\Item21.H). Class Interests. Private Bequest. Getting Static. Datedstockitem::Today() (from Code\Item21.Cc). Stream of Consciousness. A Simple Stream Example (Code\Stream1.Cc). An Empty Ostream Object. An Ostream Object with Some Data. An Ostream Object with Some More Data. An Empty Ostream Object. We All Stream for Strstream. A Strstream Formatting Example (Code\Stream2.Cc). An Empty Strstream Object. A Strstream Object with Some Contents. A Strstream Object with Some More Contents. A Strstream Object with Even More Contents. A Strstream Object after Reading Its Contents. Use It or Lose It. Default Formatting Example (Code\Coutdef1.Cc). Output of Default Formatting Example (Code\Coutdef1.Out). Output of Controlled Formatting Example (Code\Coutdef2.Out). Manipulative Behavior. Controlled Formatting Example (Code\Coutdef2.Cc). Baseless Accusations? Default Constructor for Datedstockitem (from Code\Item21.Cc). Specifying the Base Class Constructor for a Derived Class Object. Constructing a Default Datedstockitem Object. Normal Constructor for Datedstockitem (from Code\Item21.Cc). Constructing a Datedstockitem Object. Reordering Priorities. Reorder Function for Datedstockitem (from Code\Item21.Cc). Calling Reorder through a Stockitem Pointer, Part 1. Calling Reorder through a Datedstockitem Pointer. Calling Reorder through a Stockitem Pointer, Part 2. Function Call Example (Code\Nvirtual.Cc). Function Call Example Output (Code\Nvirtual.Out). Simplified Implementation for Stockitem and Datedstockitem Classes (Code\Itema.Cc). Review. Exercises. Conclusion.
10. Pretty Poly.
Definitions. Objectives of This Chapter. Polymorphism. Virtual Certainty. Dangerous Polymorphism: Interfaces of Stockitem and Datedstockitem with Virtual Reorder Function (Code\Itemb.H). Virtual Function Call Example Output (Code\Virtual.Out). A Simplified Stockitem Object without Virtual Functions. Dangerous Polymorphism: A Simplified Stockitem Object with a Virtual Function. Dangerous Polymorphism: A Simplified Datedstockitem Object with a Virtual Function. Dangerous Polymorphism: Calling a Virtual Reorder Function Through a Stockitem Pointer to a Stockitem Object. Dangerous Polymorphism: Calling a Virtual Reorder Function Through a Datedstockitem Pointer to a Datedstockitem Object. Dangerous Polymorphism: Calling a Virtual Reorder Function through a Stockitem Pointer to a Datedstockitem Object. Dangerous Polymorphism: A Simplified Stockitem Object with Two Virtual Functions. Dangerous Polymorphism: A Simplified Datedstockitem with Two Virtual Functions. a Pointed Reminder. Dangerous Polymorphism: Using Operator << with a Stockitem* (Code\Polyioa.Cc). Result of Using Operator << With a Stockitem* (Code\Polyioa.Out). Dangerous Polymorphism: Stockitem Interface with Operator << and Operator >> (Code\Itemc.H). Dangerous Polymorphism: Stockitem Implementation with Operator << and Operator >> (Code\Itemc.Cc). Dangerous Polymorphism: The Implementation of Operator << with a Stockitem* (From Code\Itemc.Cc). The Old Switcheroo. Dangerous Polymorphism: Stockitem::Write (From Code\Itemc.Cc). Dangerous Polymorphism: Datedstockitem::Write (from Code\Itemc.Cc). It's Not Polite to Point. Dangerous Polymorphism: Using Operator >> and Operator << with a Stockitem* (Code\Polyiob.Cc). Dangerous Polymorphism: The Results of Using Operator >> and Operator << with a Stockitem* (Code\Polyiob.Out). Dangerous Polymorphism: The Implementation of Operator >> (From Code\Itemc.Cc). Exercises, First Set. Pretty Polly Morphic. More Definitions. Paging Miss Management. Dangerous Polymorphism: Using Operator >> and Operator << with a Stockitem* (Code\Polyiob.Cc). Safe Polymorphism: Using Operator >> and Operator << with a Polymorphic Stockitem (Code\Polyioc.Cc). Safe Polymorphism: The Polymorphic Object Version of the Stockitem Interface (Code\Itemp.H). We'll Manage Somehow. Safe Polymorphism: The Undatedstockitem and Datedstockitem Interfaces for the Polymorphic Version of Stockitem (Code\Itempi.H). Safe Polymorphism: The Implementation of the Undatedstockitem and Datedstockitem Classes (Code\Itemp.Cc). Safe Polymorphism: The Implementation of Operator << for a Polymorphic Stockitem (from Code\Itemp.Cc). Safe Polymorphism: A Polymorphic Stockitem Object with No Date. Safe Polymorphism: A Polymorphic Stockitem Object with a Date. A Simplified Version of the Structure of a Datedstockitem Object. Setting the Standard. Safe Polymorphism: The Default Constructor for the Polymorphic Stockitem Class (from Code\Itemp.Cc). Safe Polymorphism: A Default-Constructed Polymorphic Stockitem Object. Safe Polymorphism: The Default Constructor for the Undatedstockitem Class (From Code\Itemp.Cc). Base Instincts. Safe Polymorphism: Implementing a Special Protected Constructor for Stockitem (from Code\Itemp.Cc). References Count. Starring Sharon Sharalike. Safe Polymorphism: An Example Program for Reference-Counting with Stockitems (Code\Refcnt1.Cc). Safe Polymorphism: A Normal Constructor to Create a Stockitem without a Date (From Code\Itemp.Cc). Safe Polymorphism: A Polymorphic Stockitem Object with an Undatedstockitem Worker. Safe Polymorphism: A Normal Constructor That Constructs a Stockitem Having a Date (from Code\Itemp.Cc). Safe Polymorphism: A Polymorphic Stockitem Object with a Datedstockitem Worker. Safe Polymorphism: The Copy Constructor for Stockitem (from Code\Itemp.Cc). Safe Polymorphism: Two Polymorphic Stockitem Objects Sharing the Same Undatedstockitem Worker Object. Safe Polymorphism: The Assignment Operator (Operator =) for Stockitem (From Code\Itemp.Cc). Safe Polymorphism: Two Polymorphic Stockitem Objects Sharing the Same Datedstockitem Worker Object. Safe Polymorphism: A Polymorphic Stockitem Object. The Last Shall Be First. Safe Polymorphism: The Destructor for the Stockitem Class (from Code\Itemp.Cc). Going, Going, Gone. Safe Polymorphism: The Destructor for the Stockitem Class (from Code\Itemp.Cc). For the Benefit of Posterity. Review. Exercises, Second Set. Conclusion.
11. The Home Inventory Project.
Definitions. Objectives of This Chapter. Homing in. What It Is, Mama! Interface R Us. The Initial Interface for the Homeitem Manager Class (Code/Hmit1.H). Deja Vu All over Again. The Initial Interface for the Homeitembasic and Homeitemmusic Worker Classes (Code\Hmiti1.H). What They Don't Know Won't Hurt Them. The Initial Test Program for the Homeitem Classes (Code\Hmtst1.Cc). Results of Running the First Homeitem Test Program (Code\Hmit1.Out). Initial Implementation of Homeitem Manager and Worker Classes (Code\Hmit1.Cc). Homeitem::Write (from Code\Hmit1.Cc). The Homeitem Implementation of Operator >> (from Code\Hmit1.Cc). The (Incorrect) While Loop in the Original Implementation of Operator >>. Making All Local Stops. What Have I Started? A Legal Program (Code\Fortest.Cc). Stereo Typing. An Incorrect Default Constructor for the Homeitembasic Class. Homeitembasic::Gettype (from Code\Hmit1.Cc). Homeitemmusic::Gettype (from Code\Hmit1.Cc). Homeitembasic::Write (from Code\Hmit1.Cc). Virtual Reality. Homeitemmusic::Write (from Code\Hmit1.Cc). The Initial Homeinventory Class Interface (Code\Hmin2.H). The Initial Implementation of Homeinventory (Code\Hmin2.Cc). Waste Not, Want Not. You Can Get What You Need. Another Possible Implementation of Loadinventory (from Code\Hmin2a.Cc). A Smith and Wesson Beats Four Aces. Yet Another Implementation of Loadinventory (from Code\Hmin3.Cc). Everything Is More Complicated Than It Looks. Back to the Future. The Next Interface for the Homeinventory Class (Code\Hmin4.H). The Additem Member Function of Homeinventory (from Code\Hmin4.Cc). The New Interface for Homeitem (Code\Hmit4.H). The Implementation of Homeitem::Newitem() (From Code\Hmit4.Cc). The New Version Of Operator >> (from Code\Hmit4.Cc). Strong Like Bool. Homeitembasic::Formatteddisplay (from Code\Hmit4.Cc). Homeitemmusic::Formatteddisplay (from Code\Hmit4.Cc). Leaving Well Enough Alone. the Test Program for Adding a Homeitem Interactively (Hmtst4.Cc). The Next Version of the Interface for Homeinventory (Code\Hmin5.H). The Next Version of The Homeinventory Test Program (Code\Hmtst5.Cc). The Edititem Function of Homeinventory (From Code\Hmin5.Cc). 'Tis a Gift to Be Simple. The Latest Version of the Homeitem Class Interface (Code\Hmit5.H). Homeitem::Edit (from Code\Hmit5.Cc). Homeitembasic::Copydata(). Better Read Than Dead. The Latest Version of Operator >> (From Code\Hmit5.Cc). For Your Eyes Only. The Latest Version of the Interface for the Homeitem Worker Classes (Code\Hmiti5.H). U Pluribus Enum. Homeitembasic::Getfieldname (from Code\Hmit5.Cc). Taking a Shortcut. Homeitem::Read (from Code\Hmit5.Cc). Homeitembasic::Read (from Code\Hmit5.Cc). Homeitembasic::Readinteractive (from Code\Hmit5.Cc). This Must Be the Place. Homeitembasic::Readfromfile (From Code\Hmit5.Cc). Homeitembasic::Edit (From Code\Hmit5.Cc). Homeitembasic::Formatteddisplay (from Code\Hmit5.Cc). Homeitembasic::Editfield (from Code\Hmit5.Cc). Facing the Music. Homeitemmusic::Formatteddisplay (from Code\Hmit5.Cc). Maintaining Our Position. Homeitemmusic::Readinteractive (from Code\Hmit5.Cc). Homeitemmusic::Readfromfile (from Code\Hmit5.Cc). Homeitemmusic::Editfield (from Code\Hmit5.Cc). Review. Exercises. Conclusion.
12. Homeward Bound.
Definitions. Objectives of This Chapter. Super-String Theory. The New String Class Interface (Code\String7.H). Batteries Not #Included. Construction Ahead. Default Is Mine. A Simplified Interface File for w String Class (Code\String7x.H). An Alternate String(Short Length) Constructor (from Code\String7x.Cc). Warning: Explicit Material. An Explicit Constructor Call Vs an Implicit One (Code\Strtstx.Cc). The String(Short, Char) Constructor for the String Class (From Code\String7.Cc). Adding Insult to Injury. Using Operator + for String Concatenation (Code\Strtst7a.Cc). The Implementation of Operator + for the String Class (from Code\String7.Cc). Inner Peace. The New Implementation of Operator >> (from Code\String7.Cc). Location, Location, Location. Using String::Find_Nocase (Code\Strtst7b.Cc). The Implementation of String::Find_Nocase (from Code\String7.Cc). The Less_Nocase Function (from Code\String7.Cc). Home, Sweet Home. The Latest Home Inventory Application Program (Code\Hmtst6.Cc). The Latest Version of the Homeinventory Interface (Hmin6.H). Homeinventory::Finditembydescription (from Code\Hmin6.Cc). The New Version of the Homeitem Interface (Code\Hmit6.H). Homeitembasic::Isnull (from Code\Hmit6.Cc). Nothing Ventured, Nothing Gained. A Slightly Odd Default Constructor for Homeitem (From Code\Hmit2.Cc). Error Messages Triggered by Accidental Use of 0 to Initialize a String (Code\Hmit6a.Err). Putting It All Together. First Test Session: Change Requests and Problem Reports. Second Test Session: Change Requests and Problem Reports. Third Test Session: Change Requests and Problem Reports. Fourth Test Session: Change Requests and Problem Reports. Fifth Test Session: Change Requests and Problem Reports. Round and Round We Go. Review. Exercises. Conclusion.
13. Stealing Home.
Definitions. Objectives of This Chapter. The Final Voyage. The Main() Function of the Final Version of the Home Inventory Main Program (from Code\Hmtst8.Cc). The Menuitem Enum (from Code\Hmtst8.Cc). The Getmenuchoice Function (from Code\Hmtst8.Cc). Executemenuchoice (from Code\Hmtst8.Cc). Utility Room. The Homeutility Interface (Code\Hmutil1.H). Homeutility::Ignoretillcr (from Code\Hmutil1.Cc). Homeutility::Handleerror (from Code\Hmutil1.Cc). Homeutility::Checknumericinput (from Code\Hmutil1.Cc). Number, Please. Making a List, Checking It Twice. Homeutility::Checkdateinput (from Code\Hmutil1.Cc). Enter Here. Homeutility::Getnumberorenter (from Code\Hmutil1.Cc). Secret Decoder Ring Not Required. The Rest of the Story. I Can See Clearly Now. Homeutility::Clearrestofscreen (from Code\Hmutil1.Cc). The Final Frontier. The Homeutility::Selectitem Function (from Code\Hmutil1.Cc). Checking the Inventory. the Latest Header File for the Homeinventory Class (Code\Hmin8.H). The Latest Version of Additem (from Code\Hmin8.Cc). The New Version of the Edititem Function (from Code\Hmin8.Cc). The Latest Implementation of Locateitembydescription (from Code\Hmin8.Cc). Homeinventory::Locateitembycategory (from Code\Hmin8.Cc). The Printnames Function (from Code\Hmin8.Cc). The Printall Function (from Code\Hmin8.Cc). The Storeinventory Function (from Code\Hmin8.Cc). The Displayitem Function (from Code\Hmin8.Cc). A Better Sort of Function. The Sortinventorybyname Function (from Code\Hmin8.Cc). The Selectitembypartialname Function (from Code\Hmin8.Cc). The Selectitemfromnamelist Function (from Code\Hmin8.Cc). Categorical Imperative. The Selectitemfromcategorylist Function (from Code\Hmin8.Cc). The Deleteitem Function (from Code\Hmin8.Cc). Homing In. The New Operator >> Implementation (from Code\Hmit8.Cc). The Latest Version of the Homeitembasic::Edit Function (from Code\Hmit8.Cc). The Newest Version of Homeitembasic::Readinteractive (from Code\Hmit8.Cc). The New Version of the Homeitembasic::Edititem Function (from Code\Hmit8.Cc). The Latest Version of Homeitemmusic::Readinteractive (from Code\Hmit8.Cc). The Latest Version of Homeitemmusic::Editfield (from Code\Hmit8.Cc). Are We Having Fun Yet? Review. Exercises. Conclusion.
Appendix A: Tying Up Loose Ends.
Operator Precedence. Another Native Data Type. Wrapping Up.
Appendix B: Glossary.
About the Author.
Index.
Preface.
Acknowledgements.
Letter from a Novice.
1. Introduction to Programming.
Definitions. How to Write a Program. Baby Steps. On with the Show.
2. Hardware Fundamentals.
Definitions. Objectives of This Chapter. Behind the Curtain. Disk. 1985: A Space Odyssey. RAM. Return to Sender, Address Unknown. The CPU. RAM vs CPU Speeds. A Memory Hierarchy. Caching In. Please Register Here. Odometer Trouble. The First Few Numbers. The Next Few Numbers. How Many Combinations? Back to the Future. Over-Hexed. Binary to Hex Conversion Table. Different Representations of the Same Numbers. Exercises. Registering Relief. 32 and 16 Bit Registers, before Add Ax,1. 32 and 16 Bit Registers, after Add Ax,1. 32 and 16 Bit Registers, after Add Eax,1. On a RAMpage. Registering Bewilderment. 32- and 16-Bit Register Codes. Slimming the Program. A Fetching Tale. Instruction Execution Time, Using Registers and Prefetching. Review. Conclusion. Answers to Exercises.
3. Basics of Programming.
Definitions. Objectives of This Chapter. Speed Demon. Blaming It on the Computer. That Does Not Compute. Lost in Translation. A Little Numeric Calculation. What's Going on Underneath? A Small Section of RAM. Who's on First? One Little Endian. A Big Endian Example. Exercises, First Set. Exercise 1. Underware? A Really Little Numeric Calculation. Compiling, Part 3. Execution Is Everything. A Cast of Characters. Some Real Characters and Strings (Code\Basic00.Cc). Yet Another Small Section of RAM. A Byte by Any Other Name. Some Strings Attached. Special Characters for Program Text. Exercises, Second Set. A Small Section of RAM. In and Out. Some Simple Output (Code\Basic01.Cc). Some Simple Input and Output (Code\Basic02.Cc). If Only You Knew. Using an If Statement (Code\Basic03.Cc). While We're on the Subject. Using a While Statement (Code\Basic04.Cc). Exercises, Third Set. Just Up the Block. At the Fair. A C++ Program (Code\Pump1.Cc). Novice Alert. Take It for a Spin. Exercises, Fourth Set. Review. Conclusion. Answers to Exercises. First Dinner Party Program (Code\Basic05.Cc). Second Dinner Party Program (Code\Basic06.Cc). Else If Example. Name and Age Program (Code\Basic07.Cc). Novice Program (Code\Basic08.Cc). Allowance Program (Code\Basic09.Cc).
4. More Basics.
Objectives of This Chapter. Algorithmic Thinking. Finding the Top Two Weights, First Try (Code\Pump1a.Cc). A Prize Catch. Susan's Solution to the Bug in the First Attempt. Using an If Statement with an Else Clause. Finding the Top Two Weights (Code\Pump2.Cc). What A Tangled Web We Weave. You May Already Have Won. Variables, By The Numbers. Using A Vector (Code\Vect1.Cc). Zero Isn't Nothing. Index Variables. Using A For Statement (From Code\Vect1.Cc). Sorting The Weights (From Code\Vect1.Cc). Elements Vs Values. Details, Details. Initial Situation. After The First Pass. After The Second Pass. Final Situation. To Err Is Human. A Possible Error Message. Sorting The Weights, Again (From Code\Vect1.Cc). Sorting The Weights, With Correct Initialization (From Code\Vect2.Cc). To Really Foul Things Up Requires A Computer. What, Me Worry? Garbage In, Garbage Out. Garbage Prevention, First Attempt (From Code\Vect2a.Cc). Finding The Top Three Weights Using Vectors (Code\Vect3.Cc). Review. Exercises. Exercise 1 (Code\Morbas00.Cc). Exercise 2 (Code\Morbas01.Cc). Conclusion. Answers To Exercises. Weight Requesting Program, First Try (Code\Morbas02.Cc). Error Messages From The Erroneous Weight Program (Code\Morbas02.Cc). The Corrected Weight Program (Code\Morbas03.Cc). The Weight Totaling Program (Code\Morbas04.Cc).
5. Functional Literacy.
Definitions. Objectives of This Chapter. Functioning Normally. A Sample Program with Duplicated Code (Code\Nofunc.Cc). A Function Call. Above Average. A Function to Average Two Values. Return to Sender. For the Sake of Argument. Argument Passing with One Argument (Code\Birthday.Cc). General Delivery. Using a Function. Using the Average Function (Code\Func1.Cc). A Convincing Argument. The Man Behind the Curtain. The Object of My Affections. Making an Executable. Operating Systematically. Using Your Library Card. Automatic Pilot. Stacking the Deck. A Stack with One Entry. A Stack with Two Entries. A Stack with Three Entries. Don't Call Me, I'll Call You. How It All Stacks Up. An Empty Stack. The Stack Immediately after the Call to Average. The Stack after Auto Variable Allocation. Scoped Out. Scope Vs Storage Class. Static Cling. Using an Auto Variable and Initializing It (Code\Count1.Cc). Using an Auto Variable and Not Initializing It (Code\Count2.Cc). Using a Local Static Variable and Initializing It (Code\Count3.Cc). Using a Local Static Variable and Not Initializing It (Code\Count4.Cc). Using a Global Variable and Not Initializing It (Code\Count6.Cc). Using a Global Variable and Initializing It (Code\Count5.Cc). Using Variables of Different Scopes and Storage Classes (Code\Scopclas.Cc). The Results of Using Variables of Different Scopes and Storage Classes (Code\Scopclas.Out). Exercises, First Set. Exercise 1a (Code\Inita.Cc). Exercise 1b (Code\Initb.Cc). Exercise 1c (Code\Initc.Cc). Exercise 1d (Code\Initd.Cc). Exercise 1e (Code\Inite.Cc). Exercise 1f (Code\Initf.Cc). Think Globally? A BASIC Difficulty. I Say "Live It, Or Live with It". Nesting Instinct. The Stack after the Initialization of Result. The Stack after Exiting from Average. Review. Exercises, Second Set. Exercise 2 (Code\Calc1.Cc). Conclusion. Answers to Exercises. The Stack Immediately before the Call to Mess. Immediately before Executing the First Instruction in Mess. The Stack after Mess Has Declared the Auto Variable Xyz. The Stack after Xyz Has Been Initialized. The Stack before Counter Is Called. Immediately Upon Entry to Counter. Before Execution of the First Instruction in Counter.
6. Taking Inventory.
Definitions. Objectives Of This Chapter. Pay Some Attention To The Man Behind The Curtain. Taking Stock. The Initial Sample Program For The Stockitem Class (Code\Itemtst1.Cc). More Definitions. Common Behavior. Comparison Between Native And User-Defined Types. The Initial Interface Of The Stockitem Class (Code\Item1.H). The Default Constructor For The Stockitem Class (From Code\Item1.Cc). Another Way To Write The Default Stockitem Constructor. Go To The Head Of The Class. Shop Till You Drop. Another Constructor For The Stockitem Class (From Code\Item1.Cc). Display Member Function For The Stockitem Class (From Code\Item1.Cc). The Initial Interface Of The Stockitem Class (Code\Item1.H). The Initial Implementation Of The Stockitem Class (Code\Item1.Cc). Vectoring In. Reading And Displaying A Vector Of Stockitems (Code\Itemtst2.Cc). The Read Function For The Stockitem Class (From Code\Item2.Cc). The Second Version Of The Interface For The Stockitem Class (Code\Item2.H). References Required. Don't Fence Me In. Can I Help You? First Attempt To Update Inventory Of Stockitems (Code\Itemtst3.Cc). Access Denied. An Enhanced Interface For The Stockitem Class (Code\Item4.H). The Customer Is Always Right. Some New Functions For The Stockitem Class (From Code\Item4.Cc). Updating Stockitem Inventory (Code\Itemtst4.Cc). Next Customer, Please? Interface Of Inventory Class (Code\Invent1.H). Default Constructor For Inventory Class (From Code\Invent1.Cc). Loadinventory Function For Inventory Class (From Code\Invent1.Cc). Nothing Ventured, Nothing Gained. The Implementation Of Isnull (From Code\Item5.Cc). Finditem Function For Inventory Class (From Code\Invent1.Cc). Updateitem Function For Inventory Class (From Code\Invent1.Cc). The Implementation Of Getupc (From Code\Item5.Cc). The Implementation Of Getprice (From Code\Item5.Cc). Current Interface For Inventory Class (Code\Invent1.H). Current Implementation For Inventory Class (Code\Invent1.Cc). Current Interface For Stockitem Class (Code\Item5.H). Current Implementation For Stockitem Class (Code\Item5.Cc). Updated Inventory Application (Code\Itemtst5.Cc). Paging Rosie Scenario. Review. Exercises. Conclusion. Answers To Exercises. The Write Member Function For The Stockitem Class (From Code\Item6.Cc). The Storeinventory Member Function For The Inventory Class (From Code\Invent2.Cc). The Changes To The Application Program (From Code\Itemtst6.Cc).
7. Stringing Along.
Objectives of This Chapter. Playing out the String. The String Class Interface, Initial Version (Code\String1.H). The Initial Implementation for the String Class (Code\String1.Cc). The Default Constructor for the String Class (From Code\String1.Cc). Passing Along a Few Pointers. The Dynamic Duo, New and Delete. An Empty String in Memory. Our First Test Program for The String Class (Code\Strtst1.Cc). Caution: Construction Area. The Char* Constructor for the String Class (From Code\String1.Cc). String N During Construction. A Simple Test Program for the String Class (Code\Strtst1.Cc). Constructive Criticism? The Char* Constructor for the String Class, Again (From Code\String1.Cc). Tricky Assignment. String N in Memory. Strings N and S in Memory after Compiler-Generated =. Assignment Of Responsibility. Strings N and S in Memory after Custom =. References Required. The Declaration of Operator = For the String Class. Hello, Operator? Calling the Operator = Implementation. What Is the Meaning of This? The Assignment Operator (Operator =) For the String Class (from Code\String1.Cc). Equality Now! Please Delete Me, Let Me Go. Running on Empty. the Next Assignment. A Hypothetical Assignment Operator (Operator =) for the String Class with Explicit This. The Terminator. The Destructor for the String Class (from Code/String1.Cc). Review. Exercises. Exercise 1 (Code\Strex1.Cc). Exercise 2 (Code\Strex2.Cc). Exercise 3 (Code\Strex3.Cc). Conclusion. Answers to Exercises.
8. Down the Garden Path.
Objectives of This Chapter. For Reference Only. Call by Value ("Normal Argument") Using the Compiler-Generated Copy Constructor. Unfair Copy. Call by Reference. Our First Test Program for the String Class (Code\Strtst1.Cc). Temporary Help Wanted. Assigning a C String to a String Via String::String(Char*). Copy Cat. The String Class Interface (Code\String1.H). The Copy Constructor for the String Class. Screen Test. The String Class Interface, with Display Function (Code\String3.H). The String Class Test Program, Using the Display Function (Code\Strtst3.Cc). The String Class Implementation of the Display Function. A Character Study. Array of Hope? Dangerous Characters (Code\Dangchar.Cc). A Slippery Character. Overwrought. Reaping the Whirlwind. Private Property: Keep Out! Attempted Privacy Violation (Code\Strtst3a.Cc). Maintenance Required. Yet Another Version of the String Class Interface (Code\String4.H). The String Class Implementation of the Getlength Function (from Code\String4.Cc). Using the Getlength Function in the String Class (Code\Strtst4.Cc). First Review. a String of Wins. Sorting a Vector of Strings (Code\Strsort1.Cc). The Updated String Class Interface, Including Comparison and I/O Operators (Code\String5.H). Less Than Obvious. Down for the Count. Strings X and Y in Memory. Strings X and Y in Memory, with an Embedded Null Byte. Using Operator For Strings (Code\Strtst5x.Cc). The Implementation of Operator for Strings (from Code\String5a.Cc). For Better Or Worse? Is Our Character Less Than the Other One? (from Code\String5a.Cc). The Else Clause in the Comparison Loop (from Code\String5a.Cc). Handling the Return Value (from Code\String5a.Cc). A Greater Cause. Simple Pleasures. Implementing Operator for Strings (from Code\String5.Cc). Equalization of Opportunity. Implementing Operator == for Strings (From Code\String5.Cc). Displaying Expertise. Down by the Old Cout Stream. Chaining Several Operator << Expressions Together (Code\Cout1.Cc). Gently Down the Stream. Friends of Global Progress. An Operator << Function to Output a String (From Code\String5.Cc). Members and Friends Only. Why We Need a Global Function for Operator <<. Reader and Advisor. An Operator >> Function to Input a String (from Code\String 5.Cc). Initial Here. Error from an Uninitialized Const (Code\String5x.Out). Use of a Non-Const Array Size (Code\String5y.Cc). Trying to Compile a Program with a Non-Const Array Size (Code\String5y.Out). Pointers and Setters. Second Review. Exercises. Exercise 1 (Code\Strex5.Cc). Exercise 2 (Code\Strex6.Cc). Conclusion. Answers to Exercises. The String Class Interface File (From Code\String6.H). The String Class Implementation of Operator . The String Class Implementation of Operator =. The String Class Implementation of Operator != (from Code\String6.Cc). The String Class Implementation of Operator (from Code\String6.Cc). The Test Program for the Comparison Operators of the String Class (Code\Strcmp.cc).
9. Stocking Up.
Definitions. Objectives of This Chapter. Under Control. The Next Stockitem Header File (Code\Item20.H). The Next Implementation of Stockitem (Code\Item20.Cc). Taking Inventory. The Next Header File for the Inventory Class (Code\Invent20.H). Claiming an Inheritance. The Stockitem Test Program for the Base Stockitem Class (Code\Itmtst20.Cc). The Implementation of the Inventory Class (Code\Invent20.Cc). The Reorder Function for the Stockitem Class (from Code\Item20.Cc). A Dated Approach. Ancestor Worship. Simplified Interface for Stockitem and Datedstockitem Classes (Code\Itema.H). A Simplified Stockitem Object. A Datedstockitem Object. More Definitions. Protection Racket. A Derived Class Object with Its Base Class Part. Stock Footage. The Next Version of the Inventory Control Test Program (Code\Itmtst21.Cc). Full Interface for Stockitem and Datedstockitem (Code\Item21.H). Latest Implementation of Stockitem Class and First Implementation of Datedstockitem Class (Code\Item21.H). Class Interests. Private Bequest. Getting Static. Datedstockitem::Today() (from Code\Item21.Cc). Stream of Consciousness. A Simple Stream Example (Code\Stream1.Cc). An Empty Ostream Object. An Ostream Object with Some Data. An Ostream Object with Some More Data. An Empty Ostream Object. We All Stream for Strstream. A Strstream Formatting Example (Code\Stream2.Cc). An Empty Strstream Object. A Strstream Object with Some Contents. A Strstream Object with Some More Contents. A Strstream Object with Even More Contents. A Strstream Object after Reading Its Contents. Use It or Lose It. Default Formatting Example (Code\Coutdef1.Cc). Output of Default Formatting Example (Code\Coutdef1.Out). Output of Controlled Formatting Example (Code\Coutdef2.Out). Manipulative Behavior. Controlled Formatting Example (Code\Coutdef2.Cc). Baseless Accusations? Default Constructor for Datedstockitem (from Code\Item21.Cc). Specifying the Base Class Constructor for a Derived Class Object. Constructing a Default Datedstockitem Object. Normal Constructor for Datedstockitem (from Code\Item21.Cc). Constructing a Datedstockitem Object. Reordering Priorities. Reorder Function for Datedstockitem (from Code\Item21.Cc). Calling Reorder through a Stockitem Pointer, Part 1. Calling Reorder through a Datedstockitem Pointer. Calling Reorder through a Stockitem Pointer, Part 2. Function Call Example (Code\Nvirtual.Cc). Function Call Example Output (Code\Nvirtual.Out). Simplified Implementation for Stockitem and Datedstockitem Classes (Code\Itema.Cc). Review. Exercises. Conclusion.
10. Pretty Poly.
Definitions. Objectives of This Chapter. Polymorphism. Virtual Certainty. Dangerous Polymorphism: Interfaces of Stockitem and Datedstockitem with Virtual Reorder Function (Code\Itemb.H). Virtual Function Call Example Output (Code\Virtual.Out). A Simplified Stockitem Object without Virtual Functions. Dangerous Polymorphism: A Simplified Stockitem Object with a Virtual Function. Dangerous Polymorphism: A Simplified Datedstockitem Object with a Virtual Function. Dangerous Polymorphism: Calling a Virtual Reorder Function Through a Stockitem Pointer to a Stockitem Object. Dangerous Polymorphism: Calling a Virtual Reorder Function Through a Datedstockitem Pointer to a Datedstockitem Object. Dangerous Polymorphism: Calling a Virtual Reorder Function through a Stockitem Pointer to a Datedstockitem Object. Dangerous Polymorphism: A Simplified Stockitem Object with Two Virtual Functions. Dangerous Polymorphism: A Simplified Datedstockitem with Two Virtual Functions. a Pointed Reminder. Dangerous Polymorphism: Using Operator << with a Stockitem* (Code\Polyioa.Cc). Result of Using Operator << With a Stockitem* (Code\Polyioa.Out). Dangerous Polymorphism: Stockitem Interface with Operator << and Operator >> (Code\Itemc.H). Dangerous Polymorphism: Stockitem Implementation with Operator << and Operator >> (Code\Itemc.Cc). Dangerous Polymorphism: The Implementation of Operator << with a Stockitem* (From Code\Itemc.Cc). The Old Switcheroo. Dangerous Polymorphism: Stockitem::Write (From Code\Itemc.Cc). Dangerous Polymorphism: Datedstockitem::Write (from Code\Itemc.Cc). It's Not Polite to Point. Dangerous Polymorphism: Using Operator >> and Operator << with a Stockitem* (Code\Polyiob.Cc). Dangerous Polymorphism: The Results of Using Operator >> and Operator << with a Stockitem* (Code\Polyiob.Out). Dangerous Polymorphism: The Implementation of Operator >> (From Code\Itemc.Cc). Exercises, First Set. Pretty Polly Morphic. More Definitions. Paging Miss Management. Dangerous Polymorphism: Using Operator >> and Operator << with a Stockitem* (Code\Polyiob.Cc). Safe Polymorphism: Using Operator >> and Operator << with a Polymorphic Stockitem (Code\Polyioc.Cc). Safe Polymorphism: The Polymorphic Object Version of the Stockitem Interface (Code\Itemp.H). We'll Manage Somehow. Safe Polymorphism: The Undatedstockitem and Datedstockitem Interfaces for the Polymorphic Version of Stockitem (Code\Itempi.H). Safe Polymorphism: The Implementation of the Undatedstockitem and Datedstockitem Classes (Code\Itemp.Cc). Safe Polymorphism: The Implementation of Operator << for a Polymorphic Stockitem (from Code\Itemp.Cc). Safe Polymorphism: A Polymorphic Stockitem Object with No Date. Safe Polymorphism: A Polymorphic Stockitem Object with a Date. A Simplified Version of the Structure of a Datedstockitem Object. Setting the Standard. Safe Polymorphism: The Default Constructor for the Polymorphic Stockitem Class (from Code\Itemp.Cc). Safe Polymorphism: A Default-Constructed Polymorphic Stockitem Object. Safe Polymorphism: The Default Constructor for the Undatedstockitem Class (From Code\Itemp.Cc). Base Instincts. Safe Polymorphism: Implementing a Special Protected Constructor for Stockitem (from Code\Itemp.Cc). References Count. Starring Sharon Sharalike. Safe Polymorphism: An Example Program for Reference-Counting with Stockitems (Code\Refcnt1.Cc). Safe Polymorphism: A Normal Constructor to Create a Stockitem without a Date (From Code\Itemp.Cc). Safe Polymorphism: A Polymorphic Stockitem Object with an Undatedstockitem Worker. Safe Polymorphism: A Normal Constructor That Constructs a Stockitem Having a Date (from Code\Itemp.Cc). Safe Polymorphism: A Polymorphic Stockitem Object with a Datedstockitem Worker. Safe Polymorphism: The Copy Constructor for Stockitem (from Code\Itemp.Cc). Safe Polymorphism: Two Polymorphic Stockitem Objects Sharing the Same Undatedstockitem Worker Object. Safe Polymorphism: The Assignment Operator (Operator =) for Stockitem (From Code\Itemp.Cc). Safe Polymorphism: Two Polymorphic Stockitem Objects Sharing the Same Datedstockitem Worker Object. Safe Polymorphism: A Polymorphic Stockitem Object. The Last Shall Be First. Safe Polymorphism: The Destructor for the Stockitem Class (from Code\Itemp.Cc). Going, Going, Gone. Safe Polymorphism: The Destructor for the Stockitem Class (from Code\Itemp.Cc). For the Benefit of Posterity. Review. Exercises, Second Set. Conclusion.
11. The Home Inventory Project.
Definitions. Objectives of This Chapter. Homing in. What It Is, Mama! Interface R Us. The Initial Interface for the Homeitem Manager Class (Code/Hmit1.H). Deja Vu All over Again. The Initial Interface for the Homeitembasic and Homeitemmusic Worker Classes (Code\Hmiti1.H). What They Don't Know Won't Hurt Them. The Initial Test Program for the Homeitem Classes (Code\Hmtst1.Cc). Results of Running the First Homeitem Test Program (Code\Hmit1.Out). Initial Implementation of Homeitem Manager and Worker Classes (Code\Hmit1.Cc). Homeitem::Write (from Code\Hmit1.Cc). The Homeitem Implementation of Operator >> (from Code\Hmit1.Cc). The (Incorrect) While Loop in the Original Implementation of Operator >>. Making All Local Stops. What Have I Started? A Legal Program (Code\Fortest.Cc). Stereo Typing. An Incorrect Default Constructor for the Homeitembasic Class. Homeitembasic::Gettype (from Code\Hmit1.Cc). Homeitemmusic::Gettype (from Code\Hmit1.Cc). Homeitembasic::Write (from Code\Hmit1.Cc). Virtual Reality. Homeitemmusic::Write (from Code\Hmit1.Cc). The Initial Homeinventory Class Interface (Code\Hmin2.H). The Initial Implementation of Homeinventory (Code\Hmin2.Cc). Waste Not, Want Not. You Can Get What You Need. Another Possible Implementation of Loadinventory (from Code\Hmin2a.Cc). A Smith and Wesson Beats Four Aces. Yet Another Implementation of Loadinventory (from Code\Hmin3.Cc). Everything Is More Complicated Than It Looks. Back to the Future. The Next Interface for the Homeinventory Class (Code\Hmin4.H). The Additem Member Function of Homeinventory (from Code\Hmin4.Cc). The New Interface for Homeitem (Code\Hmit4.H). The Implementation of Homeitem::Newitem() (From Code\Hmit4.Cc). The New Version Of Operator >> (from Code\Hmit4.Cc). Strong Like Bool. Homeitembasic::Formatteddisplay (from Code\Hmit4.Cc). Homeitemmusic::Formatteddisplay (from Code\Hmit4.Cc). Leaving Well Enough Alone. the Test Program for Adding a Homeitem Interactively (Hmtst4.Cc). The Next Version of the Interface for Homeinventory (Code\Hmin5.H). The Next Version of The Homeinventory Test Program (Code\Hmtst5.Cc). The Edititem Function of Homeinventory (From Code\Hmin5.Cc). 'Tis a Gift to Be Simple. The Latest Version of the Homeitem Class Interface (Code\Hmit5.H). Homeitem::Edit (from Code\Hmit5.Cc). Homeitembasic::Copydata(). Better Read Than Dead. The Latest Version of Operator >> (From Code\Hmit5.Cc). For Your Eyes Only. The Latest Version of the Interface for the Homeitem Worker Classes (Code\Hmiti5.H). U Pluribus Enum. Homeitembasic::Getfieldname (from Code\Hmit5.Cc). Taking a Shortcut. Homeitem::Read (from Code\Hmit5.Cc). Homeitembasic::Read (from Code\Hmit5.Cc). Homeitembasic::Readinteractive (from Code\Hmit5.Cc). This Must Be the Place. Homeitembasic::Readfromfile (From Code\Hmit5.Cc). Homeitembasic::Edit (From Code\Hmit5.Cc). Homeitembasic::Formatteddisplay (from Code\Hmit5.Cc). Homeitembasic::Editfield (from Code\Hmit5.Cc). Facing the Music. Homeitemmusic::Formatteddisplay (from Code\Hmit5.Cc). Maintaining Our Position. Homeitemmusic::Readinteractive (from Code\Hmit5.Cc). Homeitemmusic::Readfromfile (from Code\Hmit5.Cc). Homeitemmusic::Editfield (from Code\Hmit5.Cc). Review. Exercises. Conclusion.
12. Homeward Bound.
Definitions. Objectives of This Chapter. Super-String Theory. The New String Class Interface (Code\String7.H). Batteries Not #Included. Construction Ahead. Default Is Mine. A Simplified Interface File for w String Class (Code\String7x.H). An Alternate String(Short Length) Constructor (from Code\String7x.Cc). Warning: Explicit Material. An Explicit Constructor Call Vs an Implicit One (Code\Strtstx.Cc). The String(Short, Char) Constructor for the String Class (From Code\String7.Cc). Adding Insult to Injury. Using Operator + for String Concatenation (Code\Strtst7a.Cc). The Implementation of Operator + for the String Class (from Code\String7.Cc). Inner Peace. The New Implementation of Operator >> (from Code\String7.Cc). Location, Location, Location. Using String::Find_Nocase (Code\Strtst7b.Cc). The Implementation of String::Find_Nocase (from Code\String7.Cc). The Less_Nocase Function (from Code\String7.Cc). Home, Sweet Home. The Latest Home Inventory Application Program (Code\Hmtst6.Cc). The Latest Version of the Homeinventory Interface (Hmin6.H). Homeinventory::Finditembydescription (from Code\Hmin6.Cc). The New Version of the Homeitem Interface (Code\Hmit6.H). Homeitembasic::Isnull (from Code\Hmit6.Cc). Nothing Ventured, Nothing Gained. A Slightly Odd Default Constructor for Homeitem (From Code\Hmit2.Cc). Error Messages Triggered by Accidental Use of 0 to Initialize a String (Code\Hmit6a.Err). Putting It All Together. First Test Session: Change Requests and Problem Reports. Second Test Session: Change Requests and Problem Reports. Third Test Session: Change Requests and Problem Reports. Fourth Test Session: Change Requests and Problem Reports. Fifth Test Session: Change Requests and Problem Reports. Round and Round We Go. Review. Exercises. Conclusion.
13. Stealing Home.
Definitions. Objectives of This Chapter. The Final Voyage. The Main() Function of the Final Version of the Home Inventory Main Program (from Code\Hmtst8.Cc). The Menuitem Enum (from Code\Hmtst8.Cc). The Getmenuchoice Function (from Code\Hmtst8.Cc). Executemenuchoice (from Code\Hmtst8.Cc). Utility Room. The Homeutility Interface (Code\Hmutil1.H). Homeutility::Ignoretillcr (from Code\Hmutil1.Cc). Homeutility::Handleerror (from Code\Hmutil1.Cc). Homeutility::Checknumericinput (from Code\Hmutil1.Cc). Number, Please. Making a List, Checking It Twice. Homeutility::Checkdateinput (from Code\Hmutil1.Cc). Enter Here. Homeutility::Getnumberorenter (from Code\Hmutil1.Cc). Secret Decoder Ring Not Required. The Rest of the Story. I Can See Clearly Now. Homeutility::Clearrestofscreen (from Code\Hmutil1.Cc). The Final Frontier. The Homeutility::Selectitem Function (from Code\Hmutil1.Cc). Checking the Inventory. the Latest Header File for the Homeinventory Class (Code\Hmin8.H). The Latest Version of Additem (from Code\Hmin8.Cc). The New Version of the Edititem Function (from Code\Hmin8.Cc). The Latest Implementation of Locateitembydescription (from Code\Hmin8.Cc). Homeinventory::Locateitembycategory (from Code\Hmin8.Cc). The Printnames Function (from Code\Hmin8.Cc). The Printall Function (from Code\Hmin8.Cc). The Storeinventory Function (from Code\Hmin8.Cc). The Displayitem Function (from Code\Hmin8.Cc). A Better Sort of Function. The Sortinventorybyname Function (from Code\Hmin8.Cc). The Selectitembypartialname Function (from Code\Hmin8.Cc). The Selectitemfromnamelist Function (from Code\Hmin8.Cc). Categorical Imperative. The Selectitemfromcategorylist Function (from Code\Hmin8.Cc). The Deleteitem Function (from Code\Hmin8.Cc). Homing In. The New Operator >> Implementation (from Code\Hmit8.Cc). The Latest Version of the Homeitembasic::Edit Function (from Code\Hmit8.Cc). The Newest Version of Homeitembasic::Readinteractive (from Code\Hmit8.Cc). The New Version of the Homeitembasic::Edititem Function (from Code\Hmit8.Cc). The Latest Version of Homeitemmusic::Readinteractive (from Code\Hmit8.Cc). The Latest Version of Homeitemmusic::Editfield (from Code\Hmit8.Cc). Are We Having Fun Yet? Review. Exercises. Conclusion.
Appendix A: Tying Up Loose Ends.
Operator Precedence. Another Native Data Type. Wrapping Up.
Appendix B: Glossary.
About the Author.
Index.