O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Navigating C++ and Object-Oriented Design

Book Description


Learn ANSI C++ right from the start!

If you're going to learn C++, learn it right from the start! Navigating C++ and Object-Oriented Design is the first book that teaches ANSI C++ and the object-oriented techniques that make C++ a software development breakthrough.

This comprehensive tutorial reflects the authors' extensive experience teaching C++ to professional developers. Start with the clearest introduction to object modeling you'll ever read. Then learn all the essentials of C++ and more advanced topics such as exceptions, namespaces, and dynamic memory allocation.

Next, discover C++ classes, the basic building block of object-oriented design. Through proven analogies and examples, the authors introduce containment and inheritance, overloading, templates, RTTI, and exception handling. And, the authors' unique presentation on multiple inheritance will give you invaluable insights into this complex topic.

Learn to apply C++ and object-oriented techniques to real-world development. Discover how to design classes effectively using the authors' class design boilerplate. Understand how to design container classes. Walk through class designs using the powerful OMT methodology.

Navigating C++ and Object-Oriented Design is one of the first C++ tutorials that covers in detail powerhouse ANSI C++ features like:

  • Namespaces, bool, member templates, and RTTI

  • Explicit, export, and nothrow versions of new and delete

  • The IOStream Library and Standard Template Library

Why learn C++ simply as a "better C" when you can write C++ code that really meets its potential? One book shows you how: Navigating C++ and Object-Oriented Design!

Table of Contents

  1. Copyright
  2. Preface
  3. Acknowledgments
  4. Getting Started
    1. Object-Oriented Design
    2. Object Modeling Technique (OMT)
    3. Object Model Notation
    4. Scenarios
    5. Putting It All Together
    6. Key Point Summary
    7. Exercises
  5. C++ Basics
    1. Data Representation and Built-in Types
    2. Preprocessor Directives
    4. Type-Safe I/O
    5. Operators and Expressions
    6. Control Flow Constructs
    7. Putting It All Together
    8. Key Point Summary
    9. Exercises
  6. C++ Program Structure
    1. Functions
    2. Structures and Unions
    3. References with Functions
    4. Storage Classes
    5. Exceptions
    6. Namespaces
    7. Dynamic Memory Allocation
    8. Putting It All Together
    9. Key Point Summary
    10. Exercises
  7. Classes
    1. What Is Encapsulation?
    2. Classes
    3. Constructors
    4. Destructors
    5. What's this?
    6. Exception Objects
    7. Const Objects
    8. Volatile Objects
    9. Copy Constructors
    10. The Problem with Public Data Members
    11. Data Member Objects
    12. Class Member Initialization
    13. Putting It All Together
    14. Key Point Summary
    15. Exercises
  8. Working with Classes
    1. Using explicit
    2. Object Lifetimes
    3. Static Data Members
    4. Static Member Functions
    5. Static Objects
    6. Arrays of Class Objects
    7. Pointers to Class Members
    8. Friend Classes
    9. Nested Classes
    10. Local Classes
    11. Putting It All Together
    12. Key Point Summary
    13. Exercises
  9. Overloading
    1. Why Overload Functions?
    2. Function Overloading
    3. Overloading Resolution
    4. Why Overload Operators?
    5. Overloadable Operators
    6. Operator Functions
    7. Putting It All Together
    8. Key Point Summary
    9. Exercises
  10. Class Design
    1. What Is Class Design?
    2. A Class Design Boilerplate
    3. A String Class
    4. A Range Integer Class
    5. Putting It All Together
    6. Key Point Summary
    7. Exercises
  11. Object Storage Management
    1. Global new and delete
    2. Class-Specific new and delete
    3. Reference Counts
    4. Putting It All Together
    5. Key Point Summary
    6. Exercises
  12. Template Functions
    1. Why Should Functions Be Generic?
    2. Template Function Definition
    3. Template Function Instantiation
    4. Overloading Template Functions
    5. Specializing Template Functions
    6. Putting It All Together
    7. Key Point Summary
    8. Exercises
  13. Template Classes
    1. Why Should Classes Be Generic?
    2. Template Class Definition
    3. Template Class Instantiation
    4. Specializing Template Classes
    5. Containment with Template Classes
    6. Composite Templates
    7. Template Class Static Members
    8. Constant Expression Parameters
    9. Template Friend Functions
    10. Template Friend Classes
    11. Template Nested Classes
    12. Member Templates
    13. Putting It All Together
    14. Key Point Summary
    15. Exercises
  14. Inheritance
    1. Why Use Inheritance?
    2. Public Derivation
    3. Subtypes
    4. Virtual Functions
    5. Protected Access
    6. Using Declarations
    7. Private Derivation
    8. Protected Derivation
    9. Summary of Derivation Options
    10. Polymorphism with a Generic PtrList Class
    11. Abstract Base Classes
    12. Virtual Constructors
    13. A Class Design Boilerplate with Inheritance
    14. Putting It All Together
    15. Key Point Summary
    16. Exercises
  15. Run-Time Type Identification
    1. Why Is RTTI Necessary?
    2. The Dynamic Cast Operator
    3. The Typeid Operator
    4. RTTI Applications
    5. Putting It All Together
    6. Key Point Summary
    7. Exercises
  16. Exception Handling
    1. Why Use Exceptions?
    2. Designing with Exceptions
    3. Exception Hierarchies
    4. Resource Management
    5. Uncaught Exceptions
    6. Exception Specifications
    7. Unexpected Exceptions
    8. Putting It All Together
    9. Key Point Summary
    10. Exercises
  17. Multiple Inheritance
    1. Why Use Multiple Inheritance?
    2. Multiple Inheritance Format
    3. Multiple Inheritance Characteristics
    4. Distinct Base Classes (Pattern 1)
    5. Multiple Inclusion (Pattern 2)
    6. Virtual Base Classes (Pattern 3)
    7. Interface and Implementation
    8. Putting It All Together
    9. Key Point Summary
    10. Exercises
  18. IOStream Library
    1. Why Use the IOStream Library?
    2. IOStream Overview
    3. IOStream Examples
  19. Standard Template Library
    1. Why Use STL?
    2. STL Overview
    3. STL Examples
    4. STL References
  20. C++ Operator Precedence
    1. C++ Operator Precedence
  21. Index