首页 | 本学科首页   官方微博 | 高级检索  
     检索      

对象中的指针对封装的影响
引用本文:韩海.对象中的指针对封装的影响[J].江汉大学学报(自然科学版),2008,36(1):41-43.
作者姓名:韩海
作者单位:江汉大学,数学与计算机科学学院,武汉,430056
摘    要:提出了在C++编程环境中把对象内的指针区别对待的思想.对于内部含有指针的对象,根据对象与其中的指针所指向内容的关系,可以把指针分为内含式和外联式两类.内含式指针所指向的内容是对象的一个组成部分,外联式指针则描述对象与外部的联系.C++程序设计环境并不支持这样的划分,需要设计人员自己处理.对内含式的指针必须设计相应的拷贝构造函数,并且对赋值运算符进行重载,否则有可能破坏对象的封装特性.

关 键 词:对象  指针  分类  封装
文章编号:1673-0143(2008)01-0041-03
修稿时间:2007年9月6日

Impact of Pointers in Objects on Encapsulation
HAN Hai.Impact of Pointers in Objects on Encapsulation[J].Journal of Jianghan University:Natural Sciences,2008,36(1):41-43.
Authors:HAN Hai
Institution:HAN Hai (School of Mathematics and Computer Science, Jianghan University, Wuhan 430056, China)
Abstract: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 classi-fication,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.
Keywords:object  pointer  classification  encapsulation
本文献已被 CNKI 维普 万方数据 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号