Implementing an Operator In the following exercise, you will complete another Microsoft Windows

Thực hiện một Điều Hành Trong tập thể dục sau đây, bạn sẽ hoàn toàn khác Microsoft Windows ứng dụng đồng hồ kỹ thuật số. Phiên bản này của mã này là tương tự như tập thể dục tại Chương 16, "Các đại biểu và sự kiện." | Implementing an Operator In the following exercise you will complete another Microsoft Windows digital clock application. This version of the code is similar to the exercise in Chapter 16 Delegates and Events. However in this version the delegate method which is called every second does not receive the current hour minute and second values when the event is raised. Instead the delegate method keeps track of the time itself by updating three fields one each for the hour minute and second values. The type of these three fields is Hour Minute and Second respectively and they are all structs. However the application will not yet compile because the Minute struct is not finished. In the first exercise you will finish the Minute struct by implementing its missing addition operators. Write the operator overloads 1. Start Microsoft Visual Studio 2005 if it is not already running. 2. Open the Operators project located in the Microsoft Press Visual CSharp Step by Step Chapter 19 Operators folder in your My Documents folder. 3. In the Code and Text Editor window open the source file and locate the declarations of the hour minute and second fields at the end of the class. These fields hold the clock s current time class Clock . private Hour hour private Minute minute private Second second 4. Locate the tock method of the Clock class. This method is called every second to update the hour minute and seconds variables. The tock method looks like this private void tock if 0 if 0 The constructors for the Clock class contain the following statement that arranges for this method to be called whenever the tick event of the pulsed field is raised the pulsed field is a Ticker that uses a Timer object to generate an event every second as described in the exercises in Chapter 16. tock 5. On the Build menu click Build Solution. The project builds but displays the following error message in the Output pane .

Bấm vào đây để xem trước nội dung
TÀI LIỆU MỚI ĐĂNG
6    91    2    17-06-2024
23    91    1    17-06-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.