码迷,mamicode.com
首页 > 编程语言 > 详细

我的 C++ style

时间:2015-07-15 15:01:15      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

 1 int g_tennis;    // not use as possible
 2 
 3 int make_world() {
 4     int size = 0;
 5 
 6     return size;
 7 }
 8 
 9 const int NUMBER = 100;
10 
11 enum Color {
12     RED,
13     GREEN
14 };
15 
16 typedef int Dog;
17 
18 class MyClass {
19     public:
20         MyClass(int s, int num_entries = 0)
21             : size(s), num_entries_(num_entries), length_(0) {
22                 int book = NUMBER;
23                 book = 3;
24             }
25 
26         int size;
27 
28         // same as data member
29         int num_entries() const {
30             return num_entries_;
31         }
32 
33         void set_num_entries(int num_entries) {
34             num_entries_ = num_entries;
35         }
36 
37         // private and protected name end with underline
38     private:
39         int num_entries_;
40 
41         void foo_(double world) {
42             double *pworld = &world;
43             pworld = nullptr;
44         }
45 
46     protected:
47         int length_;
48 };
49 
50 int main() {
51 
52     return 0;
53 }

 

我的 C++ style

标签:

原文地址:http://www.cnblogs.com/jjtx/p/4648216.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!