TAILIEUCHUNG - Visual studio 2010 part 9

Microsoft Visual Studio 2010: A của Hướng dẫn mới bắt đầu Chỉ cần gõ vào tên lớp trong lĩnh vực và nhấn ENTER. Các carat sẽ xác định vị trí vào bên trong các khối lớp. Bây giờ bạn biết làm thế nào để tạo ra các lớp học, bạn sẽ cần phải biết làm thế nào để thêm thành viên, bắt đầu với các phương pháp. | 72 Microsoft Visual Studio 2010 A Beginner s Guide Just type in the class name in the field and press enter. The carat will locate to the inside of the class block. Now that you know how to create classes you ll need to know how to add members starting with methods. Writing Methods You can divide your algorithms into blocks of code called methods. In different programming languages methods are called functions procedures or subroutines. I ll use the term method as a generic term except when I need to be more specific. You ve already used methods when coding where WriteLine is a method of the Console class. A method contains one or more statements. Reasons for creating methods include the ability to modularize your code isolate complex operations in one place or group a common operation that can be reused in multiple places. The following sections show you how to declare and use methods. Declaring and Using a Method To start off I ll show you a very simple method so that you can see the syntax and understand the program flow. Listing 3-5 will move the statement from the Main method discussed in Chapter 2 into a new containing method and then add a statement to the Main method that calls the new method. Listing 3-5 Declaring and calling a method C using System using using using namespace FirstProgram class Program static void Main string args MessagePrinter msgPrint new MessagePrinter Chapter 3 Learning Just Enough C and Types and Members 73 C using System using using using namespace FirstProgram class MessagePrinter public static void PrintMessageStatic Hello from a static method. public void PrintMessageInstance Hello from an instance method. VB Module Modulel Sub Main Dim msgPrint As

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.