TY - BOOK AU - Balagurusamy, E TI - Object-Oriented Programming with C++ SN - 9789389949186 U1 - 005.133 PY - 2024/// CY - India PB - McGraw Hill Education (India) Private Limited N1 - Contents Preclace 1 Principles of Object-Oriented Programming Learning Objectives 1 1.1 Software Crisis! 1.2 Software Evolution J 1.3 A Look at Procedure-Oriented Programming 4 14 Object-Oriented Programming Paradigm 5 1.5 Basic Concepes of Object-Oriented Programming 6 1.6 Benefits of OOP 10 1.7 Object-Oriented Languages 11 1.8 Applications of OOP 12 Summary 13 Key Terms 14 Review Questions 14 Multiple-Choice Questions 15 2 Beginning with C++ Learning Objectives 17 2.1 What is C++? 17 2.2 Applications of C++ 18 2.3 A Simple C++ Program 18 2.4 More C++ Statements 22 2.5 An Example with Class 24 2.6 Structure of C++ Program 25 2.7 Creating the Source File 26 2.8 Compiling and Linking 26 Summary 27 Key Terms 27 Review Questions 28 Debugging Exercises 28 Dry-Run Exercises 29 Programming Exercises 30 Multiple-Choice Questions 303 Tokens, Expressions and Control Structure Learning Objectives 32 3.1 Introduction 12 3.2 Tokens 32 3.3 Keywords 3.3 3.5 Basic Data Types 34 3.4 Identifiers and Constants 33 3.7 Storage Classes 39 3,6 User-Defined Data Types 36 3.8 Derived Data Types 40 3.9 Symbolic Constants 41 3.10 Type Compatibility 42 3.11 Declaration of Variables 43 3.12 Dynamic Initialization of Variables 43 3.13 Reference Variables 44 3.14 Operators in C++ 46 3.15 Scope Resolution Operator 46 3.16 Member Dereferencing Operators 48 3.18 Manipulators 53 3.17 Memory Management Operators 49 3.19 Type Cast Operator 55 3.20 Expressions and Their Types 56 3.21 Special Assignment Expressions 58 3.22 Implicit Conversions 59 3.23 Operator Overloading 60 3.24 Operator Precedence 61 3.25 Control Structures 61 Summary 66 Key Terms 67 Review Questions 67 Debugging Exercises 68 Dry-Run Exercises 70 Programming Exercises 71 Multiple-Choice Questions 73 4 Functions in C++ Learning Objectives 75 4.1 Introduction 75 4.2 The Main Function 76 4.4 Call by Reference 79 4.3 Function Prototyping 77 4.6 Inline Functions 80 4.5 Return by Reference 804.7 Default Arguments 82 4.8 const Arguments 84 4.9 Recursion 83 4.te Function Overloading 87 4.11 Friend and Virtual Functions 89 4.12 Math Library Functions 89 Summary 90 Key Terms 91 Review Questions 97 Debugging Exercises 93 Dry-Run Exercises 94 Programming Exercises 95 Multiple Choice Questions 96 5 Classes and Objects Learning Objectives 97 5.1 Introduction 97 5.2 C Structures Revisited 97 5.3 Specifying a Class 99 5.4 Defining Member Functions 102 5.5 C++ Program with Class 104 5.6 Making an Outside Function Inline 106 5.7 Nesting of Member Functions 106 5.8 Private Member Functions 108 5.9 Arrays within a Class 108 5.10 Memory Allocation for Objects 113 113 5.11 Static Data Members 5.12 Static Member Functions 115 5.13 Arrays of Objects 117 5.14 Objects as Function Arguments 120 5.15 Friendly Functions 121 5.16 Returning Objects 127 5.17 const Member Functions 129 5.18 Pointers to Members 129 5.19 Local Classes 131 Summary 131 Key Terms 132 Review Questions 132 Debugging Exercises 133 Dry-Run Exercises 136 Programming Exercises 138 Multiple-Choice Questions 139 6 Constructors and Destructors letrostation 141 Learning Objectives HI 6.2 Cominectors 142 3 Parameterized Constructors 143 145 6.4 Mehiple Constructors in a Class 6.5 Constructors with Default Arguments 148 66 Dynamic Innialization of Objects 148 6.7. Copy Constructor 151 6.8 Dynamic Constructors 152 6.9 Constructing Two-Dimensional Atrays 134 6.10 const Objects 156 6.11 Destructors 156 Summary 159 Key Terms 160 Review Questions 160 Debugging Exercises 161 Dry-Run Exercises 162 Programming Exercises 165 Multiple-Choice Questions 166 7 Operator Overloading and Type Conversions Learning Objectives 168 7.1 Introduction 168 7.2 Defining Operator Overloading 169 7.3 Overloading Unary Operators 170 7.4 Overloading Binary Operators 171 7.5 Overloading Binary Operators Using Friend 174 7.6 Manipulation of Strings Using Operators 177 7.7 Some Other Operator Overloading Examples 180 7.8 Rules for Overloading Operators 182 7.9 Type Conversions 183 Summary 190 Key Terms 190 Review Questions 190 Debugging Exercises 191 Dry-Run Exercises 194 Programming Exercises 196 Multiple-Choice Questions 1968 Inheritance: Extending Classes Learning Objectives 198 8.1 Introduction 198 8.2 Defining Derived Classes 199 8.3 Single Inheritance 200 8.4 Making a Private Member Inheritable 206 8.5 Multilevel Inheritance 209 8.6 Multiple Inheritance 213 8.7 Hierarchical Inheritance 217 8.8 Hybrid Inheritance 219 8.9 Virtual Base Classes 221 8.10 Abstract Classes 225 8.11 Constructors in Derived Classes 226 8.12 Member Classes: Nesting of Classes Summary 233 232 Key Terms 234 Review Questions 234 Debugging Exercises 236 Dry-Run Exercises 238 Programming Exercises 242 Multiple-Choice Questions 244 9 Pointers, Virtual Functions and Polymorphism Learning Objectives 245 9.1 Introduction 245 9.2 Pointers 246 9.3 Pointers to Objects 255 9.4 this Pointer 260 9.5 Polymorphism 262 9.6 Pointers to Derived Classes 263 9.7 Virtual Functions 266 9.8 Pure Virtual Functions 270 272 9.9 Virtual Constructors and Destructors Summary 273 Key Terms 274 Review Questions 274 Debugging Exercises 275 Dry-Run Exercises 276 Programming Exercises 281 Multiple-Choice Questions 28210 Managing Console I/O Operations Learning Objectives 284 10.1 Introduction 284 10.2 C++ Streams 284 10.3 C++ Stream Classes 285 10.4 Unformatted 1/0 Operations 286 10.5 Formatted Console 1/0 Operations 293 Summary 308 10.6 Managing Output with Manipulators 304 Key Terms 308 Review Questions 308 Debugging Exercises 310 Dry-Run Exercises 312 313 Programming Exercises Multiple-Choice Questions 314 11 Working with Files Learning Objectives 315 11.1 Introduction 315 11.2 Classes for File Stream Operations 316 11.3 Opening and Closing a File 317 11.4 Detecting end-of-file 324 11.5 More about Open(): File Modes 324 11.6 File Pointers and their Manipulations 325 11.7 Sequential Input and Output Operations 328 11.8 Updating a File: Random Access 333 11.9 Error Handling During File Operations 337 11.10 Command-line Arguments 339 Summary 342 Key Terms 342 Review Questions 343 Debugging Exercises 344 Dry-Run Exercises 346 Programming Exercises 348 Multiple-Choice Questions 349 12 Templates Learning Objectives 350 12.1 Introduction 350 12.2 Class Templates 350 12.3 Class Templates with Multiple Parameters 355 12.4 Function Templates 357 12.5 Function Templates with Multiple Parameters 36212.6 Overloading of Template Functions 363 12.7 Member Function Templates 364 12.8 Non-type Template Arguments 365 Summary 365 Key Terms 366 Review Questions 366 Debugging Exercises 367 Dry-Run Exercises 370 Programming Exercises 372 Multiple Choice Questions 372 13 Exception Handling Learning Objectives 374 13.1 Introduction 374 13.2 Basics of Exception Handling 374. 13.3 Exception Handling Mechanism 375 13.4 Throwing Mechanism 379 13.5 Catching Mechanism 379 13.6 Rethrowing an Exception 384 13.7 Specifying Exceptions 386 13.8 Exceptions in Constructors and Destructors 388 13.9 Exceptions in Operator Overloaded Functions 389 Summary 390 Key Terms 390 Review Questions 390 Debugging Exercises 391 Dry-Run Exercises 393 Programming Exercises 398 Multiple Choice Questions 399 14 Introduction to the Standard Template Library Learning Objectives 401 14.1 Introduction 401 14.2 Components of STL 402 14.3 Containers 402 14.4 Algorithms 405 14.5 Iterators 407 14.6 Application of Container Classes 408 14.7 Function Objects 417 Summary 418 Key Terms 419 Review Questions 419 Debugging Exercises 420AM Den Esechet 423 Ports 424 Muhde Chone Onestion 425 15 Manipulating Strings Learning Objectives 427 18.1 Introduction 427 18.2 Creating string Objects 420 18.3 Manipulating String Objects 430 18.4. Relational Operations 431 18.8 String Characteristics 432 18.6 Accessing Characters in Strings 434 15.7 Comparing and Swapping 435 Summary 437 Key Terms 438 Review Questions 438 Debugging Exercises 439 Dry-Run Exercises 440 Programming Exercises 443 Multiple Choice Questions 443 16 New Features of ANSI C++ Standard Learning Objectives 16.1 Introduction 445 445 16.2 New Data Types 446 16.3 New Operators 448 16.4 Class Implementation 450 16.5 Namespace Scope 452 16.6 Operator Keywords 458 16.7 New Keywords 459 16.8 New Headers 459 Summary 460 Key Terms 461 Review Questions 461 Debugging Exercises 462 Dry-Run Exercises 465 Programming Exercises 467 Multiple-Choice Questions 467 17 Object-Oriented Systems Development Learning Objectives 469 17.1 Introduction 469 17.2 Procedure-Oriented Paradigms 47017.3 Development Tools 472 17.4 Object-Oriented Paradigm 473 17.5 Development Tools for Object-Oriented Design Paradigm 475 17.6 Steps in Object-Oriented Analysis 479 17.7 Steps in Object-Oriented Design 483 17.8 Implementation 489 17.9 Prototyping Paradigm 489 17.10 Wrapping Up 491 Summary 491 Key Terms 492 Review Questions 493 Multiple Choice Questions 494 Appendix A: Implementation of Abstract Data Types Appendix B: Projects Appendix C: C++ Operator Precedence Appendix E: Appendix D: Executing Turbo C++ Executing C++ Under Windows Appendix F: Points to Remember Appendix G: Appendix H: Glossary of Important C++ and OOP Terms Appendix I: Glossary of ANSI C++ Keywords Appendix J: C++ Proficiency Test with Answers Appendix K: Answers to Debugging Exercises Interview Questions Bibliography Index ER -