Implicit type conversion: Difference between revisions

Content added Content deleted
m (C++)
(Cleaned up task wording)
Line 8: Line 8:


;Task:
;Task:
Demonstrate the various type conversions in each language, and give an example of a ''implicit type conversion'' path from the smallest possible variable size to the largest possible variable size. (Where the size of the underlying variable's data strictly increases).
Demonstrate various type conversions and give an example of an ''implicit type conversion'' path from the smallest possible variable size to the largest possible variable size. (Where the size of the underlying variable's data strictly increases).


In strong typed languages ''some'' types are actually mutually incompatible. In this case the language may have disjoint type conversion paths, or even branching type conversion paths. (Where it occurs in a specific language, it is demonstrated in the code samples below.)
In strongly typed languages ''some'' types are actually mutually incompatible. In this case the language may have disjoint type conversion paths, or even branching type conversion paths. Give an example if your language does this.


Languages that don't support ''any'' ''implicit type conversion'' are detailed in the [[:Category:Maintenance/OmitCategoriesCreated|/Omit]] categories at the bottom of this page.
Languages that don't support ''any'' ''implicit type conversion'' can be added to the [[:Category:Maintenance/OmitCategoriesCreated|/Omit]] category.


Indicate if the language supports ''user defined'' type conversion definitions.
Indicate if your language supports ''user defined'' type conversion definitions and give an example of such a definition.   (E.g. define an ''implicit type conversion'' from '''real''' to '''complex''' numbers, or from '''char''' to an array of '''char''' of length 1.)

And give an example of such a definition.   (E.g. define an ''implicit type conversion'' from '''real''' to '''complex''' numbers, or from '''char''' to an array of '''char''' of length 1.)
<br><br>
<br><br>