← Symantec C++ for the Macintosh The Basics 1993

Symantec C++ for the Macintosh The Basics 1993

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

Symantec C++ for the Macintosh: The Basics

New Technology Building Blocks DISK INCLUDED Symantec C++ for the Macintosh: The Basics • Master the new Symantec C++ compiler • Learn the exceptional features of C++ • Design and maintain C++ applications M&T BOOKS John May & Judy Whittle

Book cover with a blue-purple grid floor scene showing a yellow cone, a green cube, a red sphere, a beige vintage computer monitor and tower, and two small figures, with a black band at the bottom right and a teal banner at the top.

Reading notes: The 'DISK INCLUDED' badge and the small 'M&T BOOKS' logo text are stylized and read as printed, with minor uncertainty about exact rendering of the logo lettering.

Printed product names
Symantec C++ for the Macintosh: The Basics
Languages
English
PDF page 1

Symantec C++ for the Macintosh: The Basics

~ Neiv Technology Building Blocks Symantec C++ for the Macintosh: The Basics • Master the new Symantec C++ compiler • Learn the exceptional features of C++ • Design and maintain C++ applications

Reading notes: No image was visible; all fields are drawn from the supplied extracted text, and the layout is unverified. The leading '~' and the word 'Neiv' appear to be OCR artifacts and may be a misreading of 'New' or a different word. Reading order and the grouping of 'Technology Building Blocks' as a series label versus part of the headline are uncertain. The bullet points are presented as body copy; their visual formatting in the original is unconfirmed. No prices, dates, or years appear in the supplied copy.

Printed product names
Symantec C++
Languages
English
PDF page 2

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

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

PDF page 3

Symantec C++ for the Macintosh: The Basics John May & Judy Whittle M&T BOOKS

A grayscale illustration shows a Macintosh-style computer on a gridded floor with a cone, a cube, a sphere, and two small human figures casting long shadows, with the title above and the publisher logo below.

Reading notes: The publisher logo reads M&T BOOKS in small print and is transcribed as shown; the vertical BOOKS text is stylized.

Printed product names
Symantec C++ · Macintosh
Languages
English
PDF page 4

M&T Books A Division of MIS:Press A Subsidiary of Henry Holt and Company, Inc. 115 West 18th Street New York, New York 10011 © 1993 by MIS:Press Printed in the United States of America All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without prior written permission from the Publisher. Contact the Publisher for information on foreign rights. Limits of Liability and Disclaimer of Warranty The Author and Publisher of this book have used their best efforts in preparing the book and the pro- grams contained in it. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The Author and Publisher make no warranty of any kind, expressed or implied, with regard to these pro- grams or the documentation contained in this book. The Author and Publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, per- formance, or use of these programs. ISBN 1-55828-276-9: $39.95 Publisher: Steve Berkowitz Associate Publisher: Brenda McLaughlin Development Editor: Margot Owens Pagan Production Editor: Mark Masuelli Assistant Production Editor: Joseph McPartland Copy Editor: Andrea Salvatore Technical Editor: Ray Valdes 95 94 93 4 3 2 1

Reading notes: Printed number sequence '95 94 93 4 3 2 1' at the end is a printing indicator with unclear meaning

Printed product names
MIS:Press · Henry Holt and Company, Inc.
Printed prices
$39.95
Printed dates
1993 · 95 · 94 · 93
Languages
English
PDF page 5

Table of Contents Ackno'Ytfledgments •••••••••••••••••..••••••••••••••••••..••••••••• xvii l'refe1ce ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• xix Why This Book is For You •••••••.••••••••••••••••••••.•••••••••••• 1 lntrc>cl11ctie>n ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ~ Prerequisites- Software and Hardware Required ..... ............ ... ... ........ .... 5 How the Book Is Organized ........... .......................................................... 5 Object-Oriented Methodology- A Powerful Approach ............................... 6 C++ ........ ..................... ............. ......... .... ... ..... .. ........... .................................. ..6 Chapter 1: Basic Programming Concepts ••••••••••••••.••• 7 Numbering Systems ............. ................................................................... ..... 7 Decimal Numbers .............................................................. ....... ............... 8 Binary Numbers ............. ........... ..... ........... ..... ... .... .................. ... .. ..... ....... 8 Hexadecimal Numbers .. .......... ... ........ ..... ... ... .......... ... .... .. .. ..... ................ 9 v

Reading notes: Table of contents contains OCR-damaged characters (e.g., 'Ackno'Ytfledgments', 'l'refe1ce', 'lntrc>cl11ctie>n') Page numbers and dot leaders are partially garbled

Languages
English
PDF page 6

Symantec C++for the Macintosh: The Basics

Symantec C++for the Macintosh: The Basics Octal Numbers ....................................................................................... 11 ASCII Characters ........................................................................................ 12 Bits, Bytes, and Nibbles ............................................................................. 13 Kilo, Mega, Giga ..................................................................................... 14 Signed and Unsigned Numbers ................................................................. 15 Ones Complement ................................................................................. 16 Twos Complement Rule ....................................................................... 17 Logic ............................................................................................................ 17 AND Operation ...................................................................................... 18 OR Operation ......................................................................................... 19 NOT Operation ...................................................................................... 21 XOR Operation ...................................................................................... 21 Summary ..................................................................................................... 22 Exercises ..................................................................................................... 22 Chapter 2: Obiect-Oriented Development ...............27 Procedural versus Object-Oriented Programming .................................... 28 Procedural Programming ....................................................................... 28 Object-Oriented Problem Solving ......................................................... 28 Putting to Rest an Old Myth ................................................................. 29 OOP and C++ .............................................................................................. 31 Advances in Development Environments ................................................32 Objects and Classes ....................................................................................33 Objects ....................................................................................................33 Classes ....................................................................................................34 Messages and Methods ...............................................................................35 Encapsulation .............................................................................................35 Class Diagrams ...........................................................................................35 Methodology ..........................................................................................38 Specifying Fields and Methods ..............................................................38 Subclassing and Inheritance ..................................................................38 Abstract Class ........................................................................................39 Overriding ................................................................................................... 40 Multiple Inheritance .................................................................................. 40 Polymorphism and Dynamic Binding ...................................................... .41 vi \

Reading notes: Table of contents text contains a possible OCR error in 'Obiect-Oriented' and spacing irregularities; reading order is contents-style page listing.

Printed product names
Symantec C++
Languages
English
PDF page 7

Table of Contents Iterator Methods .................................................................................... 42 Where to Begin an Object-Oriented Program .......................................... .44 Summary ..................................................................................................... 45 Exercises-Programming with Objects .................................................... .45 Chapter 3: The Symantec C++ Environment ••••••••••••• 47 Getting Started with Symantec C++ ......................................................... 48 Creating a Project ....................................................................................... 48 Segments ................................................................................................ 51 Creating a Source File ................................................................................ 52 Adding Libraries ......................................................................................... 53 Compiling the Program .............................................................................. 54 Running the Program ................................................................................. 55 Building an Application ............................................................................. 55 Summary ..................................................................................................... 57 Exercises ..................................................................................................... 57 Chapter 4: Fundamentals of C++ ............................59 Comments .................................................................................................. 60 Statements .................................................................................................. 61 White Space ................................................................................................ 62 Variables ..................................................................................................... 62 Reserved Variables ................................................................................. 63 Predefined Variable Types ..................................................................... 63 Declarations ........................................................................................... 66 Definitions ............................................................................................. 66 Initialization ........................................................................................... 66 Signed and Unsigned .............................................................................. 67 Specified Constants ............................................................................... 68 Logical Values ............................................................................................. 69 Strings ......................................................................................................... 69 String Constants .................................................................................... 70 Scope ........................................................................................................... 70 Operators .................................................................................................... 70 Unary Prefixed Operators ...................................................................... 74 vii

Reading notes: Source is a table of contents with dotted leaders and page numbers; no headline or advertised products present Some characters appear garbled (e.g., bullet-like symbols and stray spacing in chapter headings)

Languages
English
PDF page 8

Symantec C++for the Macintosh: The Basics Deferencing - * ................................................................................ 7 4 Address of - &. .................................................................................. 75 Negative - - ...................................................................................... 75 Ones Complement - - ..................................................................... 75 Logical NOT- ! ................................................................................ 75 Increment-++ ................................................................................ 76 Decrement - - - ............................................................................... 77 Size of - size ofl) ............................................................................... 78 Cast to- {cast) .................................................................................. 78 New Operator-new ........................................................................ 79 Delete Operator - delete .................................................................. 79 Unary Postfixed Operators .................................................................... 80 Function Call - { )............................................................................. 80 Array Subscript - [ ].......................................................................... 81 Dynamic Arrays, New ....................................................................... 82 Dynamic Arrays, Delete .................................................................... 83 Direct Selection - ............................................................................ 83 Indirect Selection - - > ........•.............•..•.•..•.•.....•...•..•...................... 84 Increment - + + ................................................................................ 84 Decrement - - - ............................................................................... 85 Binary Operators-Arithmetic and Logical .......................................... 85 Addition - +...................................................................................... 86 Subtraction - - ................................................................................. 86 Multiplication - * ............................................................................ 86 Division - / ....................................................................................... 87 Modulus - % .................................................................................... 8 7 Bitwise AND-&. ............................................................................. 87 Bitwise Inclusive OR - I .................................................................. 88 Bitwise Exclusive OR{XOR) - 11 •••••••••••••••••••••••••••••••••••••••••••••••••••••• 89 Left Shift - << ..•.•.•..•.•..•.......•....•.......•...................................•.••........ 90 Right Shift - >> .•.•..•.•..•.•............•.••..•..................................••.•.•....... 90 Equal {or replacement) - = ............................................................... 91 Binary Operators-Assignment ............................................................. 91 Addition Update - += ....................................................................... 93 Binary Operators-Comparison ............................................................ 94 viii

Reading notes: OCR-style spacing and symbol errors in operator entries (e.g., 'Deferencing', 'ofl)', 'Bitwise Exclusive OR{XOR) - 11')

Printed product names
Symantec C++ for the Macintosh
Languages
English
PDF page 9

Table of Contents Logical AND and Logical OR ............................................................ 96 Ternary Operator - ?: ........................................................................... 97 Comma Operator ................................................................................... 98 Summary ..................................................................................................... 99 Exercises ..................................................................................................... 99 Chapter 5: Controlling the Program Flow .............. 103 Statements ................................................................................................ 104 Expression and Null Statements ......................................................... 104 Blocks ................................................................................................... 104 If ............................................................................................................ 105 If-Else ................................................................................................... 108 Else-If ................................................................................................... 109 Switch ................................................................................................... 110 Switch-Break ........................................................................................ 112 Which Do I Use-Switch or If-Else? ................................................... 114 While .................................................................................................... 115 Do-While Loop .................................................................................... 116 For Loop ................................................................................................ 116 While versus For .................................................................................. 118 Break ..................................................................................................... 118 Continue ............................................................................................... 119 Labels and Goto ................................................................................... 119 Style .......................................................................................................... 121 Error from Fortran .................................................................................... 121 Rule 1: Placement of Curly Braces .......................................................... 122 Rule 2: Use Curly Braces on All If Tests ................................................. 123 Rule 3: Space Between Statement Keywords and Parentheses .............. 125 Rule 4: No Space Between Function Name and Parentheses ................ 125 Rule 5: Use Spaces Between Binary Operators ....................................... 125 Rule 6: Use Spaces After Commas and Semicolons ............................... 126 Rule 7: Capitalize Every Main Word in a Function Name .................... 126 Rule 8: Capitalize Every Main Word in a Variable Name Except the First ......................................................................................... 127 Rule 9: Use Blank Lines Only When They Convey Meaning ................ 127 ix

Reading notes: Source is a table of contents excerpt with no primary heading; headline set to null.

Languages
English
PDF page 10

Symantec C++ for the Macintosh: The Basics

Symantec C+ +for the Macintosh: The Basics Rule 10: Go Easy on the Use of Underscore U ...................................... 128 Rule 11: Use a Break on the Last Case of a Switch Statement .............. 128 Rule 12: Operators in Definition and Declaration Statements ............. 129 Summary ................................................................................................... 129 Exercises ................................................................................................... 130 Chapter 6: Functions and Variables ...................... 133 Functions .................................................................................................. 135 A Function Definition ......................................................................... 135 A Function Definition Example ...................................................... 136 Function Prototypes ............................................................................. 136 Variable Number of Arguments .......................................................... 137 Passing Function Arguments ................................................................... 138 Passing by Value .................................................................................. 139 Passing by Pointer ................................................................................ 139 Passing by Reference ............................................................................ 140 Default Arguments .............................................................................. 141 Passing Multiple Values ...................................................................... 142 Explicit Void ............................................................................................. 142 The Stack .................................................................................................. 142 The Heap ................................................................................................... 146 C and Pascal on the Macintosh ........................................................... 146 Procedures and Functions .................................................................... 147 Order of Parameters Pushed ................................................................ 148 Type Conversion ...................................................................................... 149 Variable Storage Types ............................................................................. 149 "auto" Variables ................................................................................... 150 Static Variables .................................................................................... 150 External Variables ................................................................................ 151 Register Variables ................................................................................ 152 "canst" Variables ................................................................................. 154 Reference Declarations ............................................................................ 155 Right-Left Rule ........................................................................................ 156 Function Overloading .............................................................................. 158 Scope Resolution Operator ...................................................................... 159 x

Reading notes: Source text is a table of contents with dot leaders and page numbers; no body copy was supplied. Some characters are ambiguous, e.g. 'C+ +' and 'canst' likely represent 'C++' and 'const'.

Printed product names
Symantec C++ for the Macintosh
Languages
English
PDF page 11

Table of Contents Inline Functions ................................................................................... 159 C++ Preprocessor ...................................................................................... 160 Conditional Directives ........................................................................ 161 C++ Preprocessor Examples: ................................................................ 161 #define versus const and inline ........................................................... 162 The Preprocessor and Comments ....................................................... 163 Summary ................................................................................................... 163 Exercises ................................................................................................... 163 Chapter 7: Input/Output Streams •••••••••••••••.••••••••• 165 Streams ..................................................................................................... 166 I/O Channels ........................................................................................ 166 Predefined I/O Stream Manipulator .................................................... 167 Generalized Escape Sequence .............................................................. 167 Formatted Output ................................................................................ 168 Advanced Formatting .......................................................................... 169 Input Stream Example ......................................................................... 170 I/O on the Macintosh ............................................................................... 171 Summary ................................................................................................... 171 Exercises ................................................................................................... 172 Chapter 8 Advanced Data Structures •••••••••••••••••••• 173 Pointers ..................................................................................................... 174 Initializing a Pointer ............................................................................ 175 Void Pointers ........................................................................................ 176 Arrays ........................................................................................................ 177 Initializing Array Values ...................................................................... 178 Initializing String Arrays ..................................................................... 178 Indexing Arrays .................................................................................... 179 Array Assignment ................................................................................ 179 Multidimensional Arrays .................................................................... 180 Free Store Operators ................................................................................. 181 Testing for Space .................................................................................. 181 Destroying Heap Variables .................................................................. 181 When to Use Dynamic Memory Allocation ....................................... 183 xi

Reading notes: Source is a table of contents, not an advertisement; no products or prices are advertised. Some dot leaders and page numbers are partially garbled in the extracted text.

Languages
English