The interface of a class consists of the public member functions and variables of that class.
- Make interfaces easy to use correctly and hard to use incorrectly [1,7]
- Make interfaces explicit (that is, among others, independent of global variables) [6]
- Seperate the interface of a class from its implementation [4]: allow the user not to know what kind of data types you used in the private section of your class
- Use const pointers and const references to express immutability in interfaces [3]
- Document the interfaces so that they are usable by others [2]
- Have at least one other developer review each interface [2]
- Prefer public members for interfaces [5]
- [1] Scott Meyers. Effective C++ (3rd edition). ISBN: 0-321-33487-6. Item 18: Make interfaces easy to use correctly and hard to use incorrectly.
- [2] John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 2.6: Document the interfaces so that they are usable by others. Have at least one other developer review each interface
- [3] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 7.8. Advice. page 199: '[13] Use const pointers and const references to express immutability in interfaces'
- [4] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 16.4. Advice. page 479: '[2] Seperate the interface of a class from its implementation'
- [5] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 20.7. Advice. page 611: '[11] Prefer public members for interfaces'
- [6] C++ Core Guidelines: I.1: Make interfaces explicit
- [7] C++ Core Guidelines: I.4: Make interfaces precisely and strongly typed