- 显示赋值
int buffer = 1024;
- 隐式赋值
int buffer (1024);
- 每一种内嵌数据类型都支持一个构造函数,能够将变量初始化为0
int number = int();
- 类对象通过构造函数来提供初始化的
1: class A
2: {
3: private:
4: int i;
5: public:
6: A:(int x)i(x){}
7: }
本文共 278 字,大约阅读时间需要 1 分钟。
int buffer = 1024;
int buffer (1024);
int number = int();
1: class A
2: {
3: private:
4: int i;
5: public:
6: A:(int x)i(x){}
7: }
转载于:https://www.cnblogs.com/kernux/archive/2012/11/02/2750819.html