网站首页  英汉词典

请输入您要查询的英文单词:

 

单词 Dtor
释义

Dtor

中文百科

解构子 Destructor (computer programming)

(重定向自Dtor)

解构子英语:Destructor,dtor)在面向对象进程设计里是一个方法,当对象的生命周期结束时,它会自动地被调用运行。它最主要的目的在于,清空并释放对象先前创建或是占用的内存资源。解构子的整体使用概念关键在于RAII。一个具备垃圾回收机制的编程语言,无法确保解构子是否会被运行,通常这类的编程语言不属于RAII的范围内。这类的编程语言,只要经由某个适当的函式,通常会调用Dispose()函式,做调用的动作,那么它一定会从现有资源释放对象。与使用垃圾回收机制的Finalize()相比,建议使用解构子是释放资源的适当做法。

英语百科

Destructor (computer programming) 解构子

(重定向自Dtor)

In object-oriented programming, a destructor (sometimes shortened to dtor) is a method which is automatically invoked when the object is destroyed. It can happen when its lifetime is bound to scope and the execution leaves the scope, when it is embedded into another object whose lifetime ends, or when it was allocated dynamically and is released explicitly. Its main purpose is to free the resources (memory allocations, open files or sockets, database connections, resource locks, etc.) which were acquired by the object along its life cycle and/or deregister from other entities which may keep references to it. The use of destructors is a necessity to the concept of Resource Acquisition Is Initialization (RAII).

随便看

 

英汉网英语在线翻译词典收录了3779314条英语词汇在线翻译词条,基本涵盖了全部常用英语词汇的中英文双语翻译及用法,是英语学习的有利工具。

 

Copyright © 2004-2024 encnc.com All Rights Reserved
更新时间:2025/6/19 0:58:41