In short, it means there are no restrictions on the object's use. It's the same as any other object.
A first class object is an entity that can be dynamically created, destroyed, passed to a function, returned as a value, and have all the rights as other variables in the programming language have.
Depending on the language, this can imply:
- being expressible as an anonymous literal value
- being storable in variables
- being storable in data structures
- having an intrinsic identity (independent of any given name)
- being comparable for equality with other entities
- being passable as a parameter to a procedure/function
- being returnable as the result of a procedure/function
- being constructible at runtime
- being printable
- being readable
- being transmissible among distributed processes
- being storable outside running processes
本文解释了一等公民对象的概念,即能在程序中动态创建、销毁、传递给函数、作为返回值的对象,拥有与其他变量相同的权利。此外,还探讨了不同编程语言中一等公民对象的具体表现形式。
1023

被折叠的 条评论
为什么被折叠?



