6: Initialization and Cleanup
来源:互联网 发布:图像形态学 知乎 编辑:程序博客网 时间:2024/06/13 00:51
1.constructor
In C++, the class designer can guarantee initialization of every object by providing a special function called the constructor whose name is the same as class's name.
class A{private:int a;public:A();};int main(){A ta;}In this simple example, storage is allocated for the object. And the compiler quietly inserts the call to A::A() for the object a at the point of definition. Like any member function, the first(secret) argument to the constructor is the this pointer - the address of the object for which it is being called.
Notice: If you have a constructor, the compiler ensures that construction always happend. If there are no constructors for a class, the compiler will automatically create one for you.
2.destructor
The destructor never has any arguments because destruction never needs any options.
3.no return value
Both the constructor and destructor are very unusual types of functions: they have no return value. This is distinctly diffenent from a void return value, in which the function returns nothing but you still have the option to make it something else.
- 6: Initialization and Cleanup
- thinking in java(III)--initialization and cleanup
- Initialization & Cleanup
- Initialization & Cleanup
- C++编程思想读后感(六):Initialization and Cleanup
- Notes: Initialization and CleanUp(初始化与清理)
- Chapter 4:Initialization & Cleanup
- 第四章: Initialization & Cleanup
- Initialization & Cleanup笔记
- 第六章:Initialization & Cleanup
- Day14-44.Initialization & Cleanup
- 《JAVA编程思想》学习备忘(第155页:Initialization & Cleanup)-6
- 读书笔记-Thinking in C++-第6章 初始化和清除Initialization& Cleanup
- Think In Java 笔记1 initialization & Cleanup
- Relearning in JAVA: 5)Initialization & cleanup
- Control Initialization and Layout
- Device Registration and Initialization
- Device Registration and Initialization
- MPEG4码流格式分析
- extjs官网+extjs官网案例
- PHP和MySQL一些常见报错的解释
- s3c2410 bootloader 第一部分启动代码分析
- Ruby for Rails 最佳实践十五
- 6: Initialization and Cleanup
- android 状态保存
- NSSet详解
- centos 6.2 安装intel 显卡驱动
- 总结uboot在FS2410上的移植
- 视频网站中的推荐系统
- .net 查找性能瓶颈的利器 ANTS Performance Profiler 使用方法及破解
- OCP-1Z0-053-V12.02-390题
- Ruby for Rails 最佳实践十六