... | ... | @@ -87,7 +87,8 @@ Important rules, and notable differences are summarized here: |
|
|
- Classes are designed like this:
|
|
|
- No public data member is allowed. In specific, limited, and obvious cases ```struct``` may be useful.
|
|
|
- Everything that does not need to be visible to the outside of a class/struct should be ```private``` or ```protected```. In particular member data MUST be non-public, but also consider each method, even constructors etc.
|
|
|
- Everything that should not change should be ```const```
|
|
|
- Everything that should not change should be ```const```.
|
|
|
- A ```const``` argument should be written as ```TypeName const var``` (not ```const TypeName var```)
|
|
|
- Access data members using getters and setters
|
|
|
- for setters use either by value ```setValue(type value)``` or, if ```type``` is not an integral type by reference ```setValue(const type& value)```
|
|
|
- for getters use by value ```type getValue() const {return value_;}```, or by reference ```type& value() {return value_;}``` respectively ```const type& value() const {return value_;}```. Note, use the from ```value()``` only when it returns a reference to a data member, i.e. for function chaining.
|
... | ... | |