Gotchas in the C++ programing language
来源:互联网 发布:java基本数据类型存储 编辑:程序博客网 时间:2024/06/05 03:10
Initializer lists
In C++, it is the order of the class inheritance and of the member variables that determine the initialization order, not the order of an initializer list:
#include <iostream>
class CSomeClass
{
public:
CSomeClass(int n)
{
std::cout << "CSomeClass constructor with value ";
std::cout << n << std::endl;
}
};
class CSomeOtherClass
{
public:
CSomeOtherClass() //In this example, despite the list order,
: obj2(2), obj1(1) //obj1 will be initialized before obj2.
{
//Do nothing.
}
private:
CSomeClass obj1;
CSomeClass obj2;
};
int main(void)
{
CSomeOtherClass obj;
return 0;
}
- Gotchas in the C++ programing language
- The C programing language 第一章
- The C programing language K&R 笔记
- the c programing language 练习1-17
- The C programing language chapter 6 : struct
- 重读The C Programing Language的一些小纠结。
- the c programing language 1-23 删除注释
- The C programing language 第二章课后题
- The C programing language 第三章课后题
- The C programing language 第四章,课后题
- the c programing language chap5 : pointer and array
- The C programing language chapter 7 : Input and Output
- OO Programing in C
- c++程序设计语言(the c++ programing language) 目录
- How to use C programing language in Linux as a expert[ZT]
- Day 1 :start C Language Programing course
- signed&&unsigned in the c language
- about the character string in C language
- 使用数据2分处理的通用分页存储过程 前半部分与后半部分数据访问时间相同,同等访问速度提高一倍
- 放弃
- 2分法-通用存储过程分页(top max模式)版本(性能相对之前的not in版本极大提高)
- Windows数据类型探幽——千回百转你是谁?
- 硬盘安装linux
- Gotchas in the C++ programing language
- 2007/01/29 星期一 晴
- 章8 配置测试
- 摆脱星空极速续
- Learn to use Class in Javascript
- 记账理财网站列表,用户自己挑一个用吧
- stdcall 以及 其他的dll调用方式
- .net学习之安装
- Linux 2.6 的 MMC Core