7.9. Implicit Argument Conversions

An important feature of argument passing is implicit argument conversion—converting an argument’s value to a type that the method expects to receive in its corresponding parameter. Visual Basic supports both widening and narrowing conversions. A widening conversion occurs when an argument is converted to a parameter of another type that can hold more data, whereas a narrowing conversion occurs when there is potential for data loss during the conversion (i.e., a conversion to a parameter of a type that holds a smaller amount of data). Figure 7.6 lists the widening conversions supported by Visual Basic that occur between primitive types. In addition to the conversions in Fig. 7.6, all primitive type variables ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.