You are previewing Object Oriented Programming with C++, Second Edition.
O'Reilly logo
Object Oriented Programming with C++, Second Edition

Book Description

This fully revised and indispensable edition of Object-Oriented Programming with C++ provides a sound appreciation of the fundamentals and syntax of the language, as well as of various concepts and their applicability in real-life problems. Emphasis has been laid on the reusability of code in object-oriented programming and how the concepts of class, objects, inheritance, polymorphism, friend functions, and operator overloading are all geared to make the development and maintenance of applications easy, convenient and economical.

Table of Contents

  1. Cover
  2. Title Page
  3. Contents
  4. Dedication
  5. Foreword
  6. Preface to the Second Edition
  7. Preface to the First Edition
  8. 1. Introduction to Computers and Computing
    1. 1.1 - Hardware
    2. 1.2 - Evolution of Programming Languages
    3. 1.3 - Brief History of C++
    4. 1.4 - C++ as a Superset of C Programming Language
    5. 1.5 - To Run a Program
    6. 1.6 - An Informal Introduction to C++ Program
    7. Summary
  9. 2. Moving from C to C++I
    1. 2.1 - Fundamentals
    2. 2.2 - Data Types
    3. 2.3 - Constants and Variables Declarations
    4. 2.4 - Operators and Expressions
    5. 2.5 - Library Functions
    6. 2.6 - Statements
    7. 2.7 - Pre-processor Directives
    8. 2.8 - C++ is a Block-Structured Language
    9. 2.9 - Typedef Facility
    10. 2.10 - Simple Input–Output
    11. 2.11 - Control Statements
    12. 2.12 - Iteration Statements
    13. 2.13 - End of Chapter Programs
    14. 2.14 - Flow Charts and Decision Tables
      1. For Advanced Readers
    15. Summary
    16. Exercises
  10. 3. Moving from C to C++ II
    1. 3.1 - Introduction to Functions
    2. 3.2 - Parameter Passing
    3. 3.3 - Local Versus Global Variables
    4. 3.4 - Function Overloading
    5. 3.5 - Functions with Default Arguments
    6. 3.6 - Inline Functions
    7. 3.7 - Storage Classes
    8. 3.8 - Recursion
    9. 3.9 - Scope Rules
    10. 3.10 - Arrays
    11. 3.11 - Structures
    12. 3.12 - Union
    13. 3.13 - Line Splicing
    14. 3.14 - Command Line Arguments
    15. 3.15 - Multi File Programs
    16. 3.16 - Difference Between C and C++
    17. 3.17 - End of Chapter Programs
      1. For Advanced Readers
    18. Summary
    19. Exercises
  11. 4. Object Orientation: An Introduction
    1. 4.1 - Programming Paradigms
    2. 4.2 - Popular Recent Paradigms
    3. 4.3 - An Introduction to Object Orientation
    4. 4.4 - Features of Object-Oriented Language
    5. 4.5 - Benefits of Object-Oriented Programming
    6. 4.6 - Writing Large Programs
    7. Summary
    8. Multiple Choice Questions and Answers
    9. Exercises
  12. 5. Classes and Objects
    1. 5.1 - Introduction
    2. 5.2 - Data Hiding and Encapsulation
    3. 5.3 - Member Functions
    4. 5.4 - Accessing Class Members
    5. 5.5 - Some Short Questions and Answers I
    6. 5.6 - Using Pointers for Objects
    7. 5.7 - Objects as Function Parameters
    8. 5.8 - Some Short Questions and Answers II
    9. 5.9 - Inline Functions (Within a Class)
    10. 5.10 - Static Data Members and Methods
    11. 5.11 - Friend Functions
    12. 5.12 - Friend Classes
    13. 5.13 - Access Specifier Protected
    14. 5.14 - Ideal Class Definition
    15. 5.15 - End of Chapter Programs
      1. For Advanced Readers
    16. Summary
    17. Multiple Choice Questions and Answers
    18. Exercises
  13. 6. Object Initialization and Cleanup
    1. 6.1 - Introduction
    2. 6.2 - Constructors
    3. 6.3 - Parameterized Constructor
    4. 6.4 - Pointer “this”
    5. 6.5 - Constructor Overloading
    6. 6.6 - Default Constructor
    7. 6.7 - Constructors with Default Arguments
    8. 6.8 - Copy Constructor
    9. 6.9 - Copy Initialization
    10. 6.10 - Array of Objects
    11. 6.11 - Destructors
    12. 6.12 - End of Chapter Programs
      1. For Advanced Readers
    13. Summary
    14. Multiple Choice Questions and Answers
    15. Exercises
  14. 7. Operator Overloading
    1. 7.1 - Introduction
    2. 7.2 - Unary Operator Overloading
    3. 7.3 - Binary Operator Overloading
    4. 7.4 - Friend Functions in Operator Overloading
    5. 7.5 - Overloading of Increment Operator
    6. 7.6 - Conversion Function
    7. 7.7 - End of Chapter Programs
      1. For Advanced Readers
    8. Summary
    9. Multiple Choice Questions and Answers
    10. Exercises
  15. 8. Strings
    1. 8.1 - Introduction
    2. 8.2 - Working with Strings
    3. 8.3 - Useful Functions for Operating on Strings
    4. 8.4 - Simple String Programs
    5. 8.5 - Our Own Strings
    6. 8.6 - Constructors for Type String
    7. 8.7 - Interactive Constructor for Class String
    8. 8.8 - Operator Overloading with Class String
      1. For Advanced Readers
    9. Summary
    10. Multiple Choice Questions and Answers
    11. Exercises
  16. 9. Inheritance I
    1. 9.1 - Introduction
    2. 9.2 - Derived and Base Class
    3. 9.3 - Public Derivation
    4. 9.4 - Private Derivation
    5. 9.5 - Protected Derivation
    6. 9.6 - Function Overriding
    7. 9.7 - Base and Derived Class Constructors
    8. 9.8 - End of Chapter Programs
      1. For Advanced Readers
    9. Summary
    10. Multiple Choice Questions and Answers
    11. Exercises
  17. 10. Inheritance II
    1. 10.1 - Multiple Inheritance
    2. 10.2 - Hierarchical Inheritance
    3. 10.3 - Multilevel Inheritance
    4. 10.4 - Hybrid Inheritance
    5. 10.5 - A Multipath Inheritance
    6. 10.6 - Virtual Base Class
    7. 10.7 - Constructors for Virtual Base Classes
    8. 10.8 - Classification of Inheritance
    9. 10.9 - Relationships
    10. 10.10 - Practical Class Definition
      1. For Advanced Readers
    11. Summary
    12. Multiple Choice Questions and Answers
    13. Exercises
  18. 11. Input/Output
    1. 11.1 - Introduction
    2. 11.2 - Stream I/O Classes
    3. 11.3 - Format-free Input
    4. 11.4 - Formatted Input
    5. 11.5 - Format-free Output
    6. 11.6 - Formatted Output
    7. 11.7 - The Manipulators
    8. 11.8 - Summary of Manipulators
    9. 11.9 - Our Own Manipulators
    10. 11.10 - Miscellaneous Functions
      1. For Advanced Readers
    11. Summary
    12. Multiple Choice Questions and Answers
    13. Exercises
  19. 12. Pointers
    1. 12.1 - Introduction
    2. 12.2 - The & (AND) Operator
    3. 12.3 - The * Operator
    4. 12.4 - Pointers and Arrays
    5. 12.5 - Pointer Arithmetic
    6. 12.6 - Pointer to Void
    7. 12.7 - Pointer to Function
    8. 12.8 - Dynamic Memory Allocation
    9. 12.9 - Operators new and delete
    10. 12.10 - One Dimensional Arrays Using Pointers
    11. 12.11 - Two Dimensional Arrays Using Pointers
    12. 12.12 - Pointers to User Defined Data Types
    13. 12.13 - Advantages and Disadvantages of Pointers
    14. 12.14 - End of Chapter Programs
      1. For Advanced Readers
    15. Summary
    16. Multiple Choice Questions and Answers
    17. Exercises
  20. 13. Polymorphism
    1. 13.1 - Introduction
    2. 13.2 - Compile Time Polymorphism
    3. 13.3 - Pointing to Derived Class Objects
    4. 13.4 - Virtual Functions
    5. 13.5 - Run Time Polymorphism
    6. 13.6 - Pure Virtual Functions
    7. 13.7 - Abstract Classes
    8. 13.8 - The Climax: Array of Derived Class Objects
    9. 13.9 - Implicit Derived-Class Object to Base-Class Object Conversion
    10. 13.10 - End of Chapter Programs
      1. For Advanced Readers
    11. Summary
    12. Multiple Choice Questions and Answers
    13. Exercises
  21. 14. File Handling
    1. 14.1 - Introduction
    2. 14.2 - Why Files?
    3. 14.3 - Basic File Types
    4. 14.4 - Text Files
    5. 14.5 - Binary Files
    6. 14.6 - File Opening Modes
    7. 14.7 - Classification of Files
    8. 14.8 - Direct Access Files: Simultaneous Read Write
    9. 14.9 - Files and Stream Classes
    10. 14.10 - Errors and Error Handling in File Operation
    11. 14.11 - In the Days of C
    12. 14.12 - End of Chapter Programs
      1. For Advanced Readers
    13. Summary
    14. Multiple Choice Questions and Answers
    15. Exercises
  22. 15. Templates
    1. 15.1 - Introduction to Template
    2. 15.2 - Function Template
    3. 15.3 - Class Templates
    4. 15.4 - Comparison Between Class Templates and Function Templates
    5. 15.5 - Standard Template Library
    6. 15.6 - End of Chapter Programs
      1. For Advanced Readers
    7. Summary
    8. Multiple Choice Questions and Answers
    9. Exercises
  23. 16. Miscellaneous Topics
    1. 16.1 - “const” The Protector!
    2. 16.2 - “const” with Class Objects
    3. 16.3 - Conditional Compilation
    4. 16.4 - Functions with Variable Arguments
    5. 16.5 - Bit Manipulation
    6. 16.6 - Scope Resolution Operator as Unary Operator
    7. 16.7 - Pointers to Members
      1. For Advanced Readers
    8. Summary
    9. Multiple Choice Questions and Answers
    10. Exercises
  24. 17. Graphics and Animation
    1. 17.1 - Introduction
    2. 17.2 - Graphics Initialization
    3. 17.3 - The Screen in Graphics Mode
    4. 17.4 - Uniform Look and Feel with Object Orientation
    5. 17.5 - Rotating Phasor and Sinusoidal Wave
    6. 17.6 - Periodic Waveform Generation Using Fourier Series
    7. 17.7 - Monte Carlo Method
    8. 17.8 - Storing Image on the Disk
    9. 17.9 - Animation
    10. 17.10 - Using a Mouse
    11. 17.11 - Tiger by the Tail – A VB Form
    12. 17.12 - Summary of Graphics Functions and Constants
      1. For Advanced Readers
    13. Summary
    14. Exercises
  25. 18. Exception Handling
    1. 18.1 - Introduction
    2. 18.2 - Errors and Error Handling: Life Before Exceptions
    3. 18.3 - Exception Handling Building Blocks
    4. 18.4 - Working of Exception Handling Mechanism
    5. 18.5 - Catching all Exceptions
    6. 18.6 - Object as Exception
    7. 18.7 - Re-throwing an Exception
    8. 18.8 - Exception Specification
    9. 18.9 - Stack Unwinding
    10. 18.10 - Exceptions in Constructors and Destructors
    11. 18.11 - Exceptions and Inheritance
    12. 18.12 - Class Exception
      1. For Advanced Readers
    13. Summary
    14. Multiple Choice Questions and Answers
    15. Exercises
  26. 19. Advanced Topics from ANSI/ISO C++
    1. 19.1 - New Type String
    2. 19.2 - Type Bool
    3. 19.3 - Standard Template Library (STL)
    4. 19.4 - Container Classes
    5. 19.5 - Iterators
    6. 19.6 - Algorithms
    7. 19.7 - Taxonomy of Classes
    8. 19.8 - Type Casting Operators
    9. 19.9 - Run Time Type Information RTTI
    10. 19.10 - Remaining Topics
      1. For Advanced Readers
    11. Summary
    12. Multiple Choice Questions and Answers
    13. Exercises
  27. 20. Towards Better Programming
    1. 20.1 - Introduction
    2. 20.2 - External Characteristics
    3. 20.3 - Internal Characteristics
    4. Summary
    5. Exercises
  28. 21. Collection of Programs
    1. 21.1 - Matrices
    2. 21.2 - Statistics
    3. 21.3 - Account and Finance
    4. 21.4 - Dynamic Data Structures
    5. 21.5 - Text Window
    6. 21.6 - Astrology
    7. 21.7 - Graphics
    8. Summary
    9. Exercises
  29. 22. OOAD with Snake and Ladder
    1. 22.1 - Object-Oriented Analysis (OOA)
    2. 22.2 - Object-Oriented Design (OOD)
    3. 22.3 - Analysis of Snake and Ladder Game
    4. 22.4 - The Design
  30. 23. Rule Book of C++
  31. 24. Objects Library
    1. 24.1 - Money Matter
    2. 24.2 - Numbers
    3. 24.3 - Date and Time
    4. 24.4 - Geometry
    5. 24.5 - Persons
    6. 24.6 - Books
    7. 24.7 - Strings
    8. 24.8 - Living Things
    9. 24.9 - Dynamic Data Structures
    10. 24.10 - Rail Ticket
    11. 24.11 - Timer
    12. 24.12 - Template Based Classes
    13. 24.13 - Playing Cards
    14. 24.14 - Others
  32. Appendices
    1. Appendix A: Keywords in C++
    2. Appendix B: Precedence of Operators
    3. Appendix C: List of Turbo C++ Header Files
    4. Appendix D: Flags and Manipulators
    5. Appendix E: Turbo C ++ 3.0 Environment
    6. Appendix F: Console Input–Output
    7. Appendix G Simple C Style input–output
    8. Appendix H: G++ Compiler and Codeblocks IDE
    9. Appendix I: Standard Library
    10. Appendix J: Mini Projects
  33. Notes
    1. Chapter 2
    2. Chapter 3
    3. Chapter 4
    4. Chapter 5
    5. Chapter 7
    6. Chapter 11
    7. Chapter 12
    8. Chapter 13
    9. Chapter 14
    10. Chapter 18
    11. Chapter 20
    12. Chapter 21
  34. Bibliography
  35. Glossary
  36. Copyright