1 #include <iostream> 2 using namespace std; 3 4 class as 5 { 6 public: 7 int a; 8 const int b; 9 as():b(2) 10 { 11 a = 1; 12 } 13 ~as() 14 { 15 cout << "析构函数被调用!" << endl; 16 }; 17 18 19 private: 20 int c; 21 22 }; 23 24 int main(int argc, char *argv[]) 25 { 26 as b; 27 as c; 28 cout << b.a << endl; 29 cout << b.b << endl; 30 31 return 0; 32 }
相关文章
- 06-30深度学习入门-chapter3_1
- 06-30objective-c与c++的差异
- 06-30Python 从入门到实践:练习9-6-冰淇淋小店
- 06-30Python编程从入门到实践第九章练习二
- 06-30python class的使用
- 06-30c++用vector创建二维数组
- 06-30Go语言快速入门(1)--复合数据类型(1) - 数组、slice
- 06-30golang快速入门(八)数据类型特别之处(下)
- 06-30JBoot入门示例
- 06-30Azure-900学习 云计算入门笔记整理-1