Google C++ Style Guide
1. Doing Work in Constructors
Avoid virtual method calls in constructors, and avoid initialization that can fail if you can't signal an error.
2. Implicit Conversions
Do not define implicit conversions. Use explicit keyword for conversion operators and single-argument constructors.
3. Copyable and Movable Types
A class's public API should make explicit whether the class is copable, move-only, or neither copyable not movable. Support copying and/or moving if these operations are clear and meaningful for your type.
4. Structs vs. Classes
Use a struct for passive objects that carry data; everything else is a class.
What is traits in C++?
5. Inheritance
Composition is often more appropriate than inheritance. When using inheritance, make it public.
What is virtual dispatch?
What is "Diamond" inheritance patterns?
What is the keyword 'final' for?
6. Operator Overloading
Overload operators judiciously. Do not create user-defined literals.
7. Access Control
Make classes' data members private, unless they are static const.
8. Declaration Order
Group similar declarations together, placing public parts earlier.
9. Output Parameters
Prefer using return values rather than output parameters. If output-only parameters are used they should appear after input parameters.
10. Write Short Functions
Prefer small and focused functions.
11. Reference Arguments
All parameters passed by lvalue reference must be labeled const.
12. Function Overloading
Use overloaded functions only if a reader looking at a call site can get a good idea of what is happening without having to first figure out exactly which overload is being called.