Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET AJAX in Action phần 3

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Lớp HumanResources chứa một trong những phương pháp, GetEmployeeCount, trong đó có tên khoa như một tham số. Nó sử dụng một tuyên bố chuyển đổi đơn giản để lấy số lượng nhân viên trong bộ phận. (Để giữ cho những điều đơn giản, chúng tôi hardcoded | Working with objects 81 Understanding closures and dealing with them can be difficult at first because the most used object-oriented languages don t support them. But closures have interesting applications for example the Function.createDelegate method illustrated in chapter 2 in section 2.3.4 is an application of closures. If you program in .NET using C 2.0 then you may have heard of anonymous methods which can t be called closures but that implement a similar technique. NOTE If you want to know more about C anonymous methods browse to http msdn2.microsoft.com en-us library 0yw3tz5k.aspx. So far we ve demonstrated that JavaScript functions are powerful objects but you can do much more. For example you can use functions to create custom objects as you ll see in the next section. 3.1.4 Creating custom objects In section 3.1 you saw how JavaScript objects can be created as dictionaries with name and value pairs. Each pair represents a property of the object and the value of the property. This approach may be less comfortable for developers acquainted with the mechanisms of class-based object-oriented languages. In such languages you typically specify the structure of an object in a class and then you create instances of the class using the new operator. If you want to use a similar approach in JavaScript it s possible to define a function and use it in conjunction with the new operator to create custom objects. In this case the function is called the constructor and it s used to define the properties of the new object. Following this approach listing 3.2 shows how to declare the constructor for a Cat object. Listing 3.2 The constructor for a Cat object function Cat this._name this._age 0 A JavaScript function acts as a constructor when you use it together with the new operator. The following statement creates a new object using the Cat function as the constructor var cat new Cat The new operator creates a new object and invokes the constructor. In the body of the .

TÀI LIỆU 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.