摘要
首先介绍了类的构造函数特征和分类,举例说明了组合类对象和派生类对象构造函数的构造方法及调用次序;其次研究了使用缺省拷贝构造函数时,如果类中包含new运算符而导致指针挂起的原因,并给出了解决方法;最后介绍了转换构造函数的功能及使用转换构造函数进行类型转换的步骤。
First we introduce the features and classification of class constructors, and illustrate the constructing methods and call order of combined class object and derived class object constructors, then give the solution to pointer hung caused by operator new in class while using default copy constructor, finally introduce the functions of conversion constructor and the procedure of type conversion by using conversion constructor
出处
《计算机时代》
2011年第12期30-32,共3页
Computer Era