好词典

singleton

UK //ˈsɪŋɡəltən//US //ˈsɪŋɡəltən//

词源

源自中古英语 'singul'(单个的)加上后缀 '-ton',表示状态或性质。

noun

❶ 指单独存在的事物或个体,特别用于描述只有一个成员或实例的情况。在编程中,指只能创建一个实例的设计模式。

“She was a singleton in her family, with no siblings.”

(她是家里的独生女,没有兄弟姐妹。)

“The singleton pattern ensures that a class has only one instance.”

(单例模式确保一个类只有一个实例。)

同义词:individual, sole, single, one, unique

常见短语

singleton pattern — 在软件开发中,单例模式是一种设计模式,确保一个类只有一个实例,并提供全局访问点。

“The database connection is implemented using the singleton pattern to avoid multiple instances.”

(数据库连接使用单例模式实现,以避免多个实例。)