description | title | ms.date | helpviewer_keywords | ms.assetid | |
---|---|---|---|---|---|
Learn more about: Standard Conversions and Implicit Boxing |
Standard Conversions and Implicit Boxing |
11/04/2016 |
|
33f7fc7d-5674-44a2-a859-0e6a04fae519 |
A standard conversion will be chosen by the compiler over a conversion that requires boxing.
// clr_implicit_boxing_Std_conversion.cpp
// compile with: /clr
int f3(int ^ i) { // requires boxing
return 1;
}
int f3(char c) { // no boxing required, standard conversion
return 2;
}
int main() {
int i = 5;
System::Console::WriteLine(f3(i));
}
2