Update CONTRIBUTING.md
Define the braces position in C++ header files.
This commit is contained in:
parent
2df765e189
commit
47481c76e8
|
@ -67,7 +67,20 @@ In short: The easier the code review is, the better the chance your pull request
|
|||
// Do something
|
||||
}
|
||||
```
|
||||
|
||||
However, the method definition could be defined in a header file (.h), if there's one line code only. In this case, Java-like braces should be used.
|
||||
* ###### Good:
|
||||
```cpp
|
||||
class MyClass
|
||||
{
|
||||
public:
|
||||
void method1();
|
||||
int method2() {
|
||||
return _x; // only one line code can be placed in .h as method definition
|
||||
}
|
||||
private:
|
||||
int _x;
|
||||
}
|
||||
```
|
||||
2. ##### Use tabs instead of white-spaces (we usually set our editors to 4 white-spaces for 1 tab, but the choice is up to you).
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue