O'Reilly logo

API Design for C++ by Martin Reddy

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

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 ...

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

Start Free Trial

No credit card required