Add class definition layout rules to coding policy.

This commit is contained in:
Wayne Stambaugh 2020-12-10 07:55:28 -05:00
parent a4879e740a
commit 236ab16ddb
1 changed files with 25 additions and 0 deletions

View File

@ -521,6 +521,31 @@ or:
};
~~~~~~~~~~~~~
## 4.11 Class Definition Layout ## {#class_defs}
When defining classes member variables should be placed at the bottom
and methods should be placed above the member variables. The scope
ordering of the class should be public, protect, then private. Do not
redefine the same scope multiple times in a row. Here is an example
class definition:
~~~~~~~~~~~~~{.cpp}
class FOO
{
public:
FOO();
void FooPublicMethod();
protected:
void fooProtectedMethod();
private:
void fooPrivateMethod();
// Private not redefined here unless no private methods.
int m_privateMemberVariable;
};
~~~~~~~~~~~~~
# 5. License Statement # {#license_statement}
There is a the file copyright.h which you can copy into the top of