CppEssentials - C++ Essentials Sharam Hekmat PragSoft...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: C++ Essentials Sharam Hekmat PragSoft Corporation www.pragsoft.com www.pragsoft.com Contents v Contents Contents v Preface x 1. Preliminaries 1 A Simple C++ Program 2 Compiling a Simple C++ Program 3 How C++ Compilation Works 4 Variables 5 Simple Input/Output 7 Comments 9 Memory 10 Integer Numbers 11 Real Numbers 12 Characters 13 Strings 14 Names 15 Exercises 16 2. Expressions 17 Arithmetic Operators 18 Relational Operators 19 Logical Operators 20 Bitwise Operators 21 Increment/Decrement Operators 22 Assignment Operator 23 Conditional Operator 24 Comma Operator 25 The sizeof Operator 26 Operator Precedence 27 Simple Type Conversion 28 Exercises 29 vi C++ Essentials Copyright © 2005 PragSoft 3. Statements 30 Simple and Compound Statements 31 The if Statement 32 The switch Statement 34 The while Statement 36 The do Statement 37 The for Statement 38 The continue Statement 40 The break Statement 41 The goto Statement 42 The return Statement 43 Exercises 44 4. Functions 45 A Simple Function 46 Parameters and Arguments 48 Global and Local Scope 49 Scope Operator 50 Auto Variables 51 Register Variables 52 Static Variables and Functions 53 Extern Variables and Functions 54 Symbolic Constants 55 Enumerations 56 Runtime Stack 57 Inline Functions 58 Recursion 59 Default Arguments 60 Variable Number of Arguments 61 Command Line Arguments 63 Exercises 64 5. Arrays, Pointers, and References 65 Arrays 66 Multidimensional Arrays 68 Pointers 70 Dynamic Memory 71 Pointer Arithmetic 73 Function Pointers 75 References 77 Typedefs 79 Exercises 80 www.pragsoft.com Contents vii 6. Classes 82 A Simple Class 83 Inline Member Functions 85 Example: A Set Class 86 Constructors 90 Destructors 92 Friends 93 Default Arguments 95 Implicit Member Argument 96 Scope Operator 97 Member Initialization List 98 Constant Members 99 Static Members 101 Member Pointers 102 References Members 104 Class Object Members 105 Object Arrays 106 Class Scope 108 Structures and Unions 110 Bit Fields 112 Exercises 113 7. Overloading 115 Function Overloading 116 Operator Overloading 117 Example: Set Operators 119 Type Conversion 121 Example: Binary Number Class 124 Overloading << for Output 127 Overloading >> for Input 128 Overloading 129 Overloading () 131 Memberwise Initialization 133 Memberwise Assignment 135 Overloading new and delete 136 Overloading ->, *, and & 138 Overloading ++ and -- 142 Exercises 143 8. Derived Classes 145 An illustrative Class 146 A Simple Derived Class 150 viii C++ Essentials Copyright © 2005 PragSoft Class Hierarchy Notation 152 Constructors and Destructors 153 Protected Class Members 154 Private, Public, and Protected Base Classes 155 Virtual Functions 156 Multiple Inheritance 158 Ambiguity 160 Type Conversion 161 Inheritance and Class Object Members 162 Virtual Base Classes 165 Overloaded Operators 167 Exercises 168 9. Templates 170 Function Template Definition 171 Function Template Instantiation 172 Example: Binary Search 174 Class Template Definition 176 Class Template Instantiation...
View Full Document

Page1 / 311

CppEssentials - C++ Essentials Sharam Hekmat PragSoft...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online