-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcodeStyle.cpp
47 lines (32 loc) · 898 Bytes
/
codeStyle.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// code-style.cpp // 13.file name
#define TEST_CASE (0) // 1.define
namespace mynamespace // 9.namespace
{
const int kDaysInAWeek = 7; // 12. constant names.
class MyClass // 10. class
{ // class
public:
enum SearchErrors // enum names
{
OK = 0,
ERROR_OUT_OF_MEMOTY, // 2.enum values.
ERROR_OTHER = 1, // enum values.
};
typedef std::string str_t; // 3.user define type
MyClass();
~MyClass();
int num_entries() const { return num_entries_; } // 4.class member function
void set_num_entries(int num_entries) { num_entries_ = num_entries; }
static int s_var; // 5.static var
private:
MyClass(const MyClass& obj);
MyClass& operator=(const MyClass& obj);
int _private_func_call(); // 11. private member function
int num_entries_; // 6.private member var
};
}
int g_var; // 7.global var
void test()
{
int var; // 8.local var
}