Value types
A value is a fully self-describing piece of data. Equal values are indistinguishable at during program runtime. That is, they lack identity. For example, in the C++ and Java programming languages, the integer literal is a value. It is indistinguishable from any other at runtime, and there is no way to mutate the literal to be a different value such as . In many programming languages, value types are often represented and stored in an efficient manner. For example, booleans, fixed-size integers, and fixed-size floating-point types may be compactly stored and passed in the registers of the CPU.Reference types
Reference types are represented as a reference to another value, which may itself be either a value or reference type. Reference types are often implemented using pointers, though many high-level programming languages such as Python do not expose these pointers to the programmer. Reference types have identity, meaning that it is possible to distinguish two references at runtime, even when they contain underlying values that are equal. For example, consider the following class in Java:Classification per language
Boxing and unboxing
Programming languages that distinguish between value types and reference types typically offer a mechanism, called ''boxing'', to wrap some or all of their value types in reference types. This permits the use of value types in contexts expecting reference types. The converse process (to unwrap the value type) is known as ''unboxing''.See also
* Primitive data type * Composite data typeReferences
{{DEFAULTSORT:Value Type Data types