# Elements Of C++ Macintosh Programming 1990 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-58b229f1478b2145fe5d1bf4892509074238a55f12adff09c5f9f4ba2ebb1474)

Elements of C++ Macintosh Programming

Transcribed text:

SERIES EDITOR SCOTT KNASTER

Macintosh Inside Out

Elements OF

C++ Macintosh® Programming

DAN WESTON

Image description: A book cover with a cream background, a black top band reading SERIES EDITOR and SCOTT KNASTER, a purple downward triangle labeled Macintosh Inside Out, large black and yellow stylized 'Elements' with a purple 'OF', and pink-and-black title text 'C++ Macintosh Programming' above author name DAN WESTON in spaced capitals.

Reading notes: The top-right of the black band text 'SCOTT KNASTER' and 'SERIES EDITOR' reading order relative to the triangle is approximate. The word 'OF' is set in small letters on a purple arc and may be read in different order. The ® symbol after Macintosh is small and placed at upper right of the word.

Languages: English

[Original Image 1](https://www.vintageapple.net/files/f02005e0147531c277bd46e87355b96398710eb9ba29c5ada42a96fb2a446724/f3db1a3f3c258c7714f43ab2.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-cf7ea37c0a0e7f006302178e15987c3dc14805b14882bfe4e5ca11e0ded117b3)

Elements of C++ Macintosh Programming

Transcribed text:

SERIES EDITOR SCOTT KNASTER

Macintosh Inside Out

Elements

OF

C++ Macintosh® Programming

DAN WESTON

Image description: Book cover with a yellow-highlighted large letter E in black, a purple inverted triangle labeled Macintosh Inside Out at top, a black banner reading SERIES EDITOR SCOTT KNASTER, and magenta title text on a beige background with author name DAN WESTON at bottom.

Reading notes: The word 'Elements' is stylized with the large E separate from 'lements' and the 'OF' printed in a curved purple shape; reading order is inferred from layout. The series title 'Macintosh Inside Out' appears inside the purple triangle and is partly rotated visually at the top.

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-b36dea90e2b686020b6072743ba15b5ab57d238cbf7978b59238224a0aa88dde)

Transcribed text:

From the Library of
Jerry Clark
B213 © APCo

Image description: A bookplate with calligraphic script reading "from the Library of" decorated with a sprig, a leafy flourish, three owls perched on the flourish, and an open book at the bottom, with a handwritten name in blue ink.

Reading notes: The name "Jerry Clark" is handwritten in blue ink rather than printed, and is transcribed as seen. The vertical small print "B213 © APCo" along the right edge is small and may be imperfectly read.

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-6d0f0ce0010aec6e0885a2e0ea8dc1dc983efdc3bb893a779f8fbc3f773b9909)

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

[Original PDF page 3](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-d3435b249b003e02c1b3902c8643bea863c73593b8705e6b9cba38b0a9f99642)

Elements of C++ Macintosh® Programming

Transcribed text:

Elements   of C++ Macintosh®
Programming
Dan Weston
A
'YT
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: Macintosh®

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-e95b4b7a7df99add39ab507b2c972b79eb7ea65d051356c47178c9c8af0749f3)

Transcribed text:

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.)
Library of Congress Cataloging-in-Publication Data
Weston, Dan.
Elements of C++ Macintosh programming/Dan Weston
p. cm.   -   {Macintosh inside out)
ISBN   0-201-55025-3
1. Macintosh {Computer)-Programming. 2. C++ (Computer program language) I. Title
II. Series.
QA76.8.M3W48   1990
005.26'5-dc20
Copyright© 1990 by Dan Weston
90-35408
CIP
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: John Dance
Cover Design: Ronn Campisi
Text Design: Copenhaver Cumpston
Set   in   10.5   point   Palatino   by Don Huntington
ISBN   0-201-55025-3
ABCDEFGHIJ-MW-943210
First printing, June 1990

Reading notes: Library of Congress catalog-line OCR text uses brace characters where parentheses likely appear, e.g. '{Macintosh inside out)' and '{Computer)'

Printed product names: Macintosh · Apple · Apple Computer, Inc.

Printed dates: 1990 · June 1990 · 90-35408

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-189b8cbaa1a40b6e9ae8d59fecf17bffd44016f30f0e4044417f6818a052d7df)

Image description: The image is a entirely blank white page with no visible artwork, layout elements, or markings.

[Original PDF page 6](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-02fdc2405fddd38f36d2a6ab3fe4fe288ee612d5f38f461f179248e439486c22)

Transcribed text:

Contents
Preface   xvii
Acknowledgments   xix
IJJl>   PART   ONE   Getting Your Feet Wet   1
An introduction to C++ and the concepts of object-oriented program-
ming, plus some mechanical aspects of making C++ programs in the
MPW   environment.
1.   WhyC++?   3
Reasons to Learn C   ++   3
Reasons Not to Learn C++   4
How to Learn C   ++   4
2.   C++: A Better C   7
Comments   7
Declarations and Definitions   8
Variables   9
Functions   9
When to Declare and When to Define   10
Variable Definitions Anywhere in   Code   12
Type Checking   12
vii

Reading notes: Source text is a table of contents; no advertised products, prices, or dates are present. Some characters in the page numbers and heading markers appear damaged (e.g., 'IJJl>' and 'ClassDefinitions').

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-3a2ce2da7281b718eedc4d5d3ae78ac22294ccdaede48499243ad81eb214bea7)

Transcribed text:

viii   ~   Contents
Arguments by Reference   13
Default Argument Values   14
Inline Functions   15
Const Definitions   16
Overloaded Functions   17
Streams   17
Summary   19
3.   C++   Objects   21
Class Declarations   21
Public, Protected, and Private   22
Friends   24
Accessing Members and Member Functions   24
Derived Classes   25
Members   27
Static   Members   27
Member Functions   28
"this"   as a Function Argument   28
Virtual Functions   30
Static   Member Functions   31
Constructors and Destructors   31
Virtual Destructors   33
Creating Objects   34
A Generic List Class   35
Iterating on a List   42
Summary   44
4.   Writing MPW Tools in   C++   45
Helloworld   46
Creating a Makefile   47
1/0   Redirection in   MPW   49
Command Line Arguments   55
The TTool Class   56
Initializing and Running the Tool   58
Parsing Command Line Arguments   59
Making Streams for Input and   Output   61

Reading notes: Page numbers and section labels appear in the table of contents with uncertain spacing around 'Static Members' and similar entries.

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-39a8594c3b67516dcfb1dec5695347cee5af18412953e703a443c2f8c87db847)

Transcribed text:

1/0   Redirection with TTool   62
Deriving a New Class from TTool   62
The Filter Member Function   63
The Main Function   64
Makefile for Fixcom2   65
Compiler Warnings   65
~   Contents   ix
Reading the Command Line with TTool   66
Overriding the Initialization Member Function   67
Processing the Command Line   68
Calling the Do   Work Member Function   69
Summary   70
Ill;   PART   TWO   Total   Immersion   71
Dig in and use object-oriented concepts to design nontrivial classes
specifically for the Macintosh environment. Emphasis on discussion of
how object-oriented design decisions are made.
5 .   TDoc: The Generic Document Class   73
TDoc Members   74
Constructor and Destructor   74
Initializing Documents   77
Maintaining Windows   78
Handling Events   79
Update   Events   79
Activation   81
Growing, Zooming, Dragging   83
Mouse Clicks and Key Presses   85
Idle Events   86
Handling Menus   86
Adjusting Menus   87
Handling Menu Commands   89
Cut, Copy, and   Paste   91
Handling Files   92
Opening and Closing Document Files   92
Reading and Writing Document Files   94

Reading notes: Some OCR fragments in the table of contents are garbled, such as 'Ill;' and '~' markers. Reading order of chapter and section titles may be uncertain due to extraction.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-2fb4812ffe0ac391f7747dea286e97243ba6c753612c6ff7d7db38a31df1859b)

Transcribed text:

x   ~   Contents
Saving Document Files   94
Closing Documents   96
Specifying Document File Type   98
Printing   98
Utilities   99
Compiling TDoc   100
Resources   101
Summary   102
6.   TApp: The Generic Application Class   103
Extending TList to Handle Documents   104
How to   Use   TApp   105
TApp Members   106
Clipboard Support   107
Private Clipboard and System Clipboard   108
The Clipboard without MultiFinder   109
The Clipboard with MultiFinder   111
TApp Constructor and Destructor   112
Initializing the Application   115
Cleaning   Up   After the Application   116
Making Documents   116
Opening New Documents   118
Opening Old Documents   119
Opening Documents from the Finder   121
Deleting Documents   123
Handling Events   124
Idle Events   127
Mouse Down Events   128
Key   Down Events   129
Activate Events   130
Update Events   131
MultiFinder Support   131
Suspend and Resume   133
Handling Menus   134
Adjusting Menus   134

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/1#scan-8e615323b9a2dff7227a9c1ad3e57785e42d1eef2753fe1d2eedd843215ada6f)

Transcribed text:

Handling Menu Commands   136
File Menu Commands   139
Edit Menu Commands   140
TApp Resources   141
Compiling TApp   142
Summary   143
7.   Helloworld, Revisited   145
Subclassing TApp and TDoc   146
THelloDoc   146
THelloApp   148
Making New THelloDoc Objects   148
The Draw Member Function   149
The Helloworld2 Main Program   149
The Helloworld2 Resources   151
~   Contents   xi
Helloworld2 Makefile: Putting   It   All Together   152
Debugging Helloworld2 with SADE   158
Summary   159
l)i>   PART THREE Swimming   161
How to use the T   App and TDoc classes developed in Part II. The true
benefits of object-oriented programming become   obviouS'   while design
flaws in the original TApp and TDoc classes are revealed. The chapter
on MacApp shows how to use another, more fully developed class
system.
8.   Scribble   163
Making a TScribbleDoc   164
TScribbleDoc's Constructor   164
Scribbling Functions   166
File Type and Creator   168
Opening Files from the Finder   170
Reading and Writing Scribble Files   170
Handling Menus   172
Handling Menu Commands   172
Adjusting Menus   174

Reading notes: Source appears to be a book table of contents and chapter excerpt rather than an advertisement; no headline or products identified. Some words may be OCR-broken, e.g. 'Helloworld2' and 'TApp' spacing, and 'obviouS'' with a stray capital.

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/468b538726950c9ac59fb7f9c7a8a1b2c886a6eaabc515454bcef266677861f0/Elements_Of_C-_Macintosh_Programming_1990.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-elements-of-c-macintosh-programming-1990-8c9ea4/2.md)
