Clarify class/struct preference

Classes and structs both have their place, and it is confusing to always
prefer one of them. It depends on the situation.
The reworded version follows C++ Core Guideline C.2:
"Use class if the class has an invariant; use struct if the data members
can vary independently"
This commit is contained in:
Antonia Lechner 2019-03-25 16:37:16 +00:00
parent 4ce382ffa6
commit c74bca9f74
1 changed files with 2 additions and 1 deletions

View File

@ -185,7 +185,8 @@ Formatting is enforced using clang-format. For more information about this, see
# C++ features
- Do not use namespaces, except for anonymous namespaces.
- Prefer use of `using` instead of `typedef`.
- Prefer use of `class` instead of `struct`.
- Prefer use of `class` instead of `struct` if there is an invariant between
members.
- Write type modifiers before the type specifier.
- Make references `const` whenever possible
- Make member functions `const` whenever possible