Boxing (computer programming): Difference between revisions

Content deleted Content added
mNo edit summary
mNo edit summary
Line 1:
In [[computer science]], an '''object type''' (a.k.a. wrapping object) is a [[datatype]] that is used in [[object-oriented programming]] to wrap a non-object type to make it look like an object.
 
Some [[object-oriented programming language]]s make a distinction betweeenbetween objects an non-objects, often referred to as [[primitive type]]s for reasons such as runtime efficiency and syntax or semantic issues. For example, [[Java programming language|Java]] has object types corresponding to each primitive type: <code>Integer</code> and <code>int</code>, and <code>Character</code> and <code>char</code>. Languages like [[C Plus Plus|C++]] make little or no distinction between objects and non-objects, the use of object type is of little interest.
 
'''Boxing''' is a way to wrap [[object (computer science)|object]]s with [[primitive type]]s over [[object type]]s so that they can be used like objects. Examples are [[Integer]] class for integer type in [[Java programming language|Java]]. Some languages require programmers to do boxing manually, while some support '''autoboxing'''/'''unboxing'''.