← C++ Programming with MacApp

C++ Programming with MacApp

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

C++ Programming with MacApp

SERIES EDITOR SCOTT KNASTER Macintosh Inside Out C++ Programming with MacApp® DISK INCLUDED DAVID A. WILSON LARRY S. ROSENSTEIN DAN SHAFER

Book cover with a green inverted triangle at top bearing 'Macintosh Inside Out', a tilted tan panel with large black 'C++ Programming', a yellow arc containing 'WITH', an orange band with large red 'MacApp®' lettering, a small blue floppy disk icon labeled 'DISK INCLUDED', and author names in black serif capitals at the bottom.

Reading notes: Series editor line and 'Macintosh Inside Out' tagline are set in small red and cream type; reading order taken as top-to-bottom. The word 'WITH' is set along a curved yellow arc and may be read in a different order by some readers. Registered trademark symbol after MacApp is small and assumed to be ®.

Printed product names
MacApp · Macintosh Inside Out
Languages
English
PDF page 1

C++ Programming with MacApp

SERIES EDITOR SCOTT KNASTER Macintosh Inside Out C++ Programming WITH MacApp® DISK INCLUDED DAVID A. WILSON LARRY S. ROSENSTEIN DAN SHAFER

A book cover with a cream background, a green downward-pointing triangle at top holding the series title, a tilted tan panel behind large black 'C++ Programming' lettering, a yellow arc with 'WITH' and an orange panel with pink 'MacApp' lettering, and a small blue floppy disk icon marked 'DISK INCLUDED' at right.

Reading notes: The series line 'SERIES EDITOR' and 'SCOTT KNASTER' sit on a red and blue band at top and are partly printed in a spaced-out style; reading order is inferred from layout. The word 'WITH' is set along a curved yellow arc and its letters are rotated, so its reading order is inferred. The registered trademark symbol after MacApp is small and was transcribed as ®.

Printed product names
MacApp
Languages
English
PDF page 2

The image is a entirely blank white page with no visible artwork, layout, or text.

Reading notes: No visible text or imagery found; the page appears blank.

PDF page 3

C++ Programming with MacApp

C++ Programming with MacApp David A. Wilson Larry S. Rosenstein Dan Shafer Addison-Wesley Publishing Company, Inc. Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario Wokingham, England Amsterdam Bonn Sydney Singapore Tokyo Madrid San Juan

Printed product names
MacApp
Languages
English
PDF page 4

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book and Addison-Wesley was aware of a trademark claim, the designations have been printed in initial capital letters (e.g., Apple is a registered trademark of Apple Computer, Inc.) Copyright© 1990 by David A. Wilson, Larry S. Rosenstein, and Dan Shafer Some of the art in this manuscript is copyrighted by Trici Venola and Kurt Wahlner. Copyright© 1987. 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, without the prior written permission of the publisher. Printed in the United States of America. Published simultaneously in Canada. Sponsoring Editor: Carole McClendon Technical Reviewer: Curt Bianchi Cover Design: Ronn Campisi Text Design: Copenhaver Cumpston Set in 10.5 point Palatino by Don Huntington ISBN 0-201-57020-3 ABCDEFGHIJ-MW-9432100 First printing, July 1990

Reading notes: Copyright line for art reads 'Copyright© 1987' with no explicit rights holder beyond named artists

Printed product names
Apple
Printed dates
1990 · 1987 · July 1990
Languages
English
PDF page 5

The image is a entirely blank white page with no visible artwork, layout elements, or text.

Reading notes: No visible text or graphics appear anywhere on the page, so the transcript is empty.

PDF page 6

Contents Preface xxi Acknowledgments xxiii IJll> PART ONE The Framework 1 1. Introduction 3 Is this Book for You? 3 Are You a C Programmer? 4 Are You a Pascal Programmer? 4 Are You a C++ Programmer? 4 Are You a Good Programmer? 5 How Much Do You Need to Know? 6 Basic Programming Knowledge 7 Macintosh Knowledge 8 What's in This Book? 8 Patience as an Object 9 Joining Other MacApp Developers 9 Summary 10 2. Getting Started with MacApp 11 What Is MacApp? 11 Who Uses MacApp? 12 Why Learn MacApp and Object Programming? 12 Making You a Better Programmer 12 vii

Reading notes: Source text contains spaced-out characters in some lines (e.g., 'C Programmer'), reading as OCR spacing artifacts.

Languages
English
PDF page 7

viii ~ Contents C and Pascal Are Not Enough 14 Features and Benefits of Object Programming 14 Object-Oriented Design 14 Readable, Maintainable Code 15 Reusable Code 15 Programming by Successive Refinement 16 Features and Benefits of MacApp 16 Full User Interface Support 16 Guaranteed Compatibility 17 Making It Easy to Undo 17 Debugging Tools 17 Memory Management 18 Error Handling 18 Easy Printing 18 Easy Text Editing 18 Easy Dialogs 18 What Is Left for You to Do? 19 A Real-Life Example 19 Writing a Paint Program 20 Adding a New View 24 Changing Your Mind Set 24 Programming in the Closet 25 The Upside-Down Library 26 Summary 28 3. Object Programming Concepts 29 Terminology 29 Learning Object Programming 30 What Are Objects? 30 Sending Messages 33 Strange Terminology 35 Where to Get Objects 35 Classes of Objects 36 Class Diagrams 36 Subclassing and Inheritance 37 Inheriting Properties 37 Overriding Properties 39 Reusing Unique Code 39

Reading notes: Source appears to be a table of contents with no advertised products, prices, or dates; headline not identifiable from supplied copy.

Printed product names
MacApp
Languages
English
PDF page 8

The Price You Pay 40 What's Different? 40 Programming with Objects 42 The Learning Process 42 Obstacles 43 Review 44 Summary 45 .,. Contents ix 4. Object-Oriented Design: Modeling the Real World 47 Where to Begin? 47 Nouns and Verbs 47 Photography 47 Think in Terms of Small Methods 48 Increasing Reusability 50 Subclass Existing Classes 50 Look for Common Properties 52 Assemble New Classes from Existing Ones 53 Moon Landing Simulator Example 56 Design Goal 56 Strategy 57 First Try at a Moon Lander Design 57 Improving the Design 58 An Even Better Design 59 Summary 61 _., PART TWO Getting Started in MacApp 63 5. Setting Up MacApp with Macintosh Programmer's Workshop 65 The MPW Philosophy 65 What You Need to Get Started 66 Software 66 Recommended Hardware 66 Preparing the Hard Disk 67 The MPW Folder 67 The MacApp Folder 69 UsingMPW 73 Getting Help 74 The Mark Menu 76

Reading notes: Source appears to be a table of contents with no primary heading Some leading characters in the table of contents are damaged or ambiguous (e.g., '.,.' and '_.,')

Languages
English
PDF page 9

x ~ Contents Pascal's Separately Compiled Units 77 Creating Resources 79 Installing MacApp 82 Debug and Non-debug Versions of MacApp 83 Five Magic Files 84 Summary 86 6. The Languages: Object Pascal and C++ 87 A Bit of History 88 Object Pascal 88 The "Money" Accounting Program 89 MPWTools 90 The Money.p file 91 Defining a Class 93 Defining a Subclass 93 Overriding a Method 94 Creating Objects 94 Sending a Message 95 Initialization Methods and SELF 96 Reusing Overridden Code 97 The Main Program 97 The Make File 98 Object Pascal Review 99 The C ++ Language 99 Language Overview 99 New Features (Not Specifically Object-Oriented) 100 Overloaded Function Names 101 Defining a Class 104 Constructor Methods 106 Creating Objects 107 C++ Sample Programs 108 The TinyBenchmark Program 108 Program Structure 108 Program Files 109 The Main Program 115 Building the Program 116 The Results 118 Benchmark, a More Elaborate Program 120

Reading notes: Source appears to be a table of contents with page numbers; no primary heading is clearly printed.

Printed product names
MacApp · Object Pascal · C++ · MPWTools
Languages
English
PDF page 10

Program Structure 120 Static and Dynamic Allocation of Objects 121 Defining the Test Class 123 The Test Methods 126 The Timer Classes 127 TLoopTimer Methods 129 Testing With a Main Program 130 Building the Program 135 Test Results 136 Back to Accounting 137 What We Still Have to Do 137 The New, Improved Money Program 137 Using Multiple Source Files 140 The Main Program 142 Program Results 145 Details of the TOrder class 145 Details of the Customer Classes 147 Overriding a Method 151 Printing an Invoice Using Method Lookup 152 Details of the DataBase Class 153 Type Checking for Objects 154 Reusability and Maintainability 155 Building the Program 155 What Kind of Objects Get Created? 157 C++ Review 158 Summary 158 7. The MacApp Class Library 159 Why Do We Need MacApp? 159 TObject: Everyone's Ancestor 162 Variables 162 IJJi. Contents xi Methods Often Used by Your Application 162 Methods Often Overridden in Your Application 162 TEvtHandler: Handling Menu Items, Mouse Clicks, and Typing 162 Variables 163 Methods Often Used 163 Methods Often Overridden 163 TApplication: Running the Main Event Loop 163

Reading notes: Source is a table of contents excerpt, not advertising copy; no advertised products or prices are present.

Printed product names
MacApp
Languages
English
PDF page 11

xii ~ Contents Instance Variables 164 Methods Always Used 165 Methods Often Overridden 165 TDocument: Storing Information 166 Instance Variables 167 Method Always Used 167 Methods Usually Overridden 167 TView: Displaying Information on the Screen 168 Instance Variables 169 Methods Often Used 170 Methods Usually Overridden 170 Methods Sometimes Overridden 171 TWindows 172 Instance Variables 172 Scrolling 173 Dialogs 174 View Review 174 TList: Keeping Track of a Collection of Objects 175 Methods Often Used 176 TCommand: Supporting Undo 176 Instance Variables 177 Methods Always Used 177 Methods Often Overridden 177 Summary 178 8. MacApp Default Behavior 179 Supporting the User Interface 179 Making Your Program Different 180 How Much Code Will You Have to Write? 181 Which Methods to Override 182 Launching the Application 182 Application Launched from Finder 183 Document Opened from Finder 183 Document Printed from Finder 183 Opening an Existing File 184 Saving a File to Disk 184 Handling Window Events 186 Update Event 186 Activate Event 187

Languages
English