In object-oriented programming, a value type is a data type that can exist outside dynamic memory allocation. Unlike reference types, value types can be directly embedded into composite objects.

Primitive types are always value types.

Value types can exist in dynamically allocated memory, such as embedded into a dynamic object. Some platforms also allow direct dynamic allocation of value objects, while others require the value to be copied into a specific dynamic object. The later process is called boxing.

On some platforms, a value may be directly linked to by a pointer or reference. On others, it is a prerogative of reference types.

Language support

  • In Java, the only value types are the primitive types. A primitive type cannot be dynamically created on its own, so the class library provides primitive wrapper classes.
  • As C++ has no built-in support for reference types, all types can be assumed to be value types (although reference type behavior can be emulated by restricting access to a type's constructor). C++ supports direct allocation and referencing of all values.
  • The .NET Framework allows user-defined and complex value types, as well as boxing of any value type.

No comments have been added.



Your name:

City:

Country:

Your comments:

Security check *
(Please enter the number into adjoining box)