对象的创建和存在时间(含外文出处)
来源:56doc.com 资料编号:5D12489 资料等级:★★★★★ %E8%B5%84%E6%96%99%E7%BC%96%E5%8F%B7%EF%BC%9A5D12489
资料以网页介绍的为准,下载后不会有水印.资料仅供学习参考之用. 密 保 惠 帮助
资料介绍
对象的创建和存在时间(含外文出处)(中文3400字,英文1700字)
摘要:本文件要介绍了对象的创建和存在时间,以及操纵对象时要考虑的一些因素,也介绍了关于对象存在时间的一些知识。阐述了对象创建过程需要注意的问题。重点介绍了集合与继承器和单根结构。
对象的创建和存在时间
从技术角度说,OOP(面向对象程序设计)只是涉及抽象的数据类型、继承以及多形性,但另一些问题也可能显得非常重要。本节将就这些问题进行探讨。
OBJECT LANDSCAPES AND LIFETIMES
Technically, OOP is just about abstract data typing, inheritance, and polymorphism, but other issues can be at least as important. The remainder of this section will cover these issues.
One of the most important factors is the way objects are created and destroyed. Where is the data for an object and how is the lifetime of the object controlled? There are different philosophies at work here. C++ takes the approach that control of efficiency is the most important issue, so it gives the programmer a choice. For maximum run-time speed, the storage and lifetime can be determined while the program is being written, by placing the objects on the stack (these are sometimes called automatic or scoped variables) or in the static storage area. |