tailieunhanh - XÂY DỰNG LỚP - ĐỐI TƯỢNG phần 4

Sử dụng tham số. | Ví dụ Sử dụng tham số. using System public class Time public void DisplayCurrentTime 0 1 2 3 4 5 Date Month Year Hour Minute Second public int GetHour return Hour public void SetTime int hr out int min ref int sec Neu số giây truyền vào 30 thì tăng số Minute và Second 0 if sec 30 Minute Second 0 Hour hr thiết lập giá trị hr được truyền vào Trả về giá trị mới cho min và sec min Minute sec Second public Time dt Year Month Date Hour Minute Second biến thành viên private private int Year private int Month private int Date private int Hour private int Minute private int Second public class Tester static void Main currentTime Time t new Time currentTime int theHour 3 int theMinute int theSecond 20 theHour out theMinute ref theSecond The Minute is now 0 and 1 seconds . theMinute theSecond theSecond 45 theHour out theMinute ref theSecond The Minute is now 0 and 1 seconds theMinute theSecond Kết quả 8 6 2002 15 35 .

crossorigin="anonymous">
Đã 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.