<分区>
我正在尝试从 Alex Stepanov 和 Paul McJones 的“编程基础”着手。在第 5 页最后一段:他们说,
“本书使用的编程语言无法将值和值类型与对象和对象类型分开描述。”
我的意思是,有人可以举一个编程语言的例子,在这种语言中,可以将值描述为与对象分离的实体。
<分区>
我正在尝试从 Alex Stepanov 和 Paul McJones 的“编程基础”着手。在第 5 页最后一段:他们说,
“本书使用的编程语言无法将值和值类型与对象和对象类型分开描述。”
我的意思是,有人可以举一个编程语言的例子,在这种语言中,可以将值描述为与对象分离的实体。
最佳答案
听起来他们指的是值类型和引用类型。类似于此维基百科条目中的文本 ( http://en.wikipedia.org/wiki/Object_type_(object-oriented_programming) )
Some object-oriented programming languages make a distinction between reference and value types, often referred to as objects and non-objects on platforms where complex value types don't exist, for reasons such as runtime efficiency and syntax or semantic issues. For example, Java has primitive wrapper classes corresponding to each primitive type: Integer and int, Character and char, Float and float, etc. Languages like C++ have little or no notion of reference type; thus, the use of object type is of little interest.
C# 有引用和值类型:http://msdn.microsoft.com/en-us/library/4d43ts61(v=vs.90).aspx
关于c++ - 值和对象不同的编程语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13696659/