Chapter 6

C++ Usage

Publisher Summary

This chapter describes the qualities that make a good API in C++. Many specific C++ style decisions can affect the quality of an API, such as the use of namespaces, operators, friends, and const correctness. A namespace is a logical grouping of unique symbols. It provides a way to avoid naming collisions so that two APIs do not try to define symbols with the same name. Const correctness refers to use of the C++ const keyword to declare a variable or method as immutable. It is a compile-time construct that can be used to maintain the correctness of code that should not modify certain variables. Operator overloading is used to preserve the natural semantics for operators, such as using the + operator to implement ...

Get API Design for C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.