C++初始化列表

first :

类中是否可以const 成员变量?

实例一:

 1 #include <stdio.h>
 2 
 3 class Test
 4 {
 5 private:
 6     const int ci;
 7 public:
 8     Test()
 9     {
10         ci = 10;
11     }
12     int getCI() 
13     { 
14         return ci; 
15     }
16 };
17 
18 
19 int main()
20 {
21     Test t;
22     
23     printf("t.ci = %d
", t.getCI());
24     
25     return 0;
26 }
原文地址:https://www.cnblogs.com/lemaden/p/10115188.html