TAILIEUCHUNG - C Language Reference Manual_4

Quá tải độ phân giải độ phân giải quá tải là một cơ chế để lựa chọn các thành viên chức năng tốt nhất để gọi cho một danh sách đối số và thiết lập một thành viên chức năng ứng cử viên. Tình trạng quá tải giải quyết lựa chọn thành viên chức năng để gọi trong các bối cảnh khác biệt sau đây trong C #: | Chapter 7 Expressions class Test static void F ref object x . static void Main object a new object 10 object b new string 10 F ref a 0 Ok F ref b 1 ArrayTypeMismatchException the second invocation of F causes an ArrayTypeMismatchException to be thrown because the actual element type of b is string and not object. Overload resolution Overload resolution is a mechanism for selecting the best function member to invoke given an argument list and a set of candidate function members. Overload resolution selects the function member to invoke in the following distinct contexts within C Invocation of a method named in an invocation-expression . Invocation of a constructor named in an object-creation-expression . Invocation of an indexer accessor through an element-access . Invocation of a predefined or user-defined operator referenced in an expression and . Each of these contexts defines the set of candidate function members and the list of arguments in its own unique way. However once the candidate function members and the argument list have been identified the selection of the best function member is the same in all cases First the set of candidate function members is reduced to those function members that are applicable with respect to the given argument list . If this reduced set is empty an error occurs. Then given the set of applicable candidate function members the best function member in that set is located. If the set contains only one function member then that function member is the best function member. Otherwise the best function member is the one function member that is better than all other function members with respect to the given argument list provided that each function member is compared to all other function members using the rules in . If there is not exactly one function member that is better than all other function members then the function member invocation is ambiguous and an error occurs. The .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.