TAILIEUCHUNG - Professional VB 2005 - 2006 phần 3

, kể từ khi sự tách biệt của giao diện từ việc thực hiện của nó là cốt lõi của lập trình hướng đối tượng và thiết kế. Kể từ khi phương pháp này được khai báo là công cộng, đó là có sẵn cho bất kỳ mã bên ngoài lớp học, bao gồm các ứng dụng khác có thể sử dụng lắp ráp. | Chapter 5 To include a method as part of your interface you can simply declare a Public routine Public Sub AMethod Simpo PDF EMerge and Split Unregistered Version - http Notice that there is no code in this routine. Any code would be implementation and is not part of the interface. Only the declaration of the method is important when discussing interfaces. This can seem confusing at first but it is an important distinction since the separation of the interface from its implementation is at the very core of object-oriented programming and design. Since this method is declared as Public it is available to any code outside the class including other applications that may make use of the assembly. If the method has a property you can declare it as part of the interface by using the Property keyword Public Property AProperty As String End Property You can also declare events as part of the interface by using the Event keyword Public Event AnEvent Finally you can include actual variables or attributes as part of the interface Public AnInteger As Integer This is strongly discouraged because it directly exposes the internal variables for use by code outside the class. Since the variable is directly accessible from other code you give up any and all control over the way the value may be changed or by which code may be accessed. Rather than making any variable Public it is far preferable to make use of a Property method to expose the value. In that way you can implement code to ensure that your internal variable is only set to valid values and that only the appropriate code has access to the value based on your application s logic. Using the Native Interface In the end the native or primary interface for any class is defined by looking at all the methods properties events and variables that are declared as anything other than Private in scope. This includes any methods properties events or variables that are inherited from a base class. You re used to .

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.