摘要
提出了在C++编程环境中把对象内的指针区别对待的思想.对于内部含有指针的对象,根据对象与其中的指针所指向内容的关系,可以把指针分为内含式和外联式两类.内含式指针所指向的内容是对象的一个组成部分,外联式指针则描述对象与外部的联系.C++程序设计环境并不支持这样的划分,需要设计人员自己处理.对内含式的指针必须设计相应的拷贝构造函数,并且对赋值运算符进行重载,否则有可能破坏对象的封装特性.
Advances the idea of differentiating the pointers inside objects in C++ programming system. Based on the relation between the objects and the contents pointed, pointers can be classified into two types: embedded pointers and exterior pointers. The content pointed by an embedded pointer is regarded as a portion of the object, while an exterior pointer describes the connection to the outside. Anyhow, the object-oriented programming systems do not support this kind of classification, programmers must write the copy constructing function definitely for embedded pointers, and the operator should be overloaded, or the encapsulation of the objects will be affected.
出处
《江汉大学学报(自然科学版)》
2008年第1期41-43,共3页
Journal of Jianghan University:Natural Science Edition
关键词
对象
指针
分类
封装
object
pointer: classification
encapsulation