C# 2005 Programmer’s Reference - chapter 12

Tham khảo tài liệu 'c# 2005 programmer’s reference - chapter 12', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 12 parameter-modifier ref out parameter-array attributesopt params array-type identifier The parameter list is made up of one or more comma-separated parameters. Note that only the last parameter can be a parameter array. A fixed-parameter consists of An optional set of attributes An optional ref or out modifier A type An identifier There are four kinds of formal parameters Value parameters. Declared without any modifiers Reference parameters. Declared with the ref modifier. A reference parameter does not create a new storage location and must be initialized before passing to a method. Instead it represents the same storage location as the variable given as the argument in the method invocation. Output parameters. Declared with the out modifier. An output parameter does not create a new storage location and does not need to be initialized before passing to a method. Instead it represents the same storage location as the variable given as the argument in the method invocation. Parameter arrays. Declared with the params modifier. Apart from allowing a variable number of arguments during invocation a parameter array is equivalent to a value parameter. Static Instance Methods When a method declaration includes a static modifier that method is static. When there isn t a static modifier present the method is an instance. Virtual Methods When an instance method declaration includes a virtual modifier that method is virtual. When no virtual modifier is present the method is nonvirtual. Override Method When an instance method declaration includes an override modifier the method is an override. An override method is used to override an inherited virtual method with the same signature. 180 Classes A compiler error is generated unless all of the following conditions are true The overridden base method is virtual abstract or override it cannot be static or nonvirtual . The overridden base method is not sealed. The override declaration and the overridden base method have

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
35    75    1    25-05-2024
91    65    2    25-05-2024
Đã 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.