Standard Conversions and Implicit Boxing
A standard conversion will be chosen by the compiler over a conversion that requires boxing.
Example
// 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
See also
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho