Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Absolute C++ (4th Edition) part 16
Đang chuẩn bị liên kết để tải về tài liệu:
Absolute C++ (4th Edition) part 16
Tuyết Trinh
41
10
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Absolute C++ (4th Edition) part 16. KEY BENEFIT: C++ programming concepts and techniques are presented in a straightforward style using understandable language and code. KEY TOPICS: C++ Basics; Flow of Control; Function Basics; Parameters and Overloading; Arrays; Structures and Classes; Constructors; Operator Overloading, Friends, and References; Strings; Pointers and Dynamic Arrays; Separate Compilation and Namespaces; Streams and File I/O; Recursion; Inheritance; Polymorphism and Virtual Functions; Templates; Linked Data Structures; Exception Handling; Standard Template Library; Patterns and UML. MARKET: Useful for both beginning and intermediate C++ programmers. . | 152 Parameters and Overloading Now suppose your program also requires a function to compute the average of three numbers. You might define a new function called ave3 as follows double ave3 double n1 double n2 double n3 return n1 n2 n3 3.0 This will work and in many programming languages you have no choice but to do something like this. However C overloading allows for a more elegant solution. In C you can simply use the same function name ave for both functions. In C you can use the following function definition in place of the function definition ave3 double ave double n1 double n2 double n3 return n1 n2 n3 3.0 so that the function name ave then has two definitions. This is an example of overloading. In this case we have overloaded the function name ave. Display 4.6 embeds these two function definitions for ave into a complete sample program. Be sure to notice that each function definition has its own declaration prototype . The compiler can tell which function definition to use by checking the number and types of the arguments in a function call. In the program in Display 4.6 one of the functions called ave has two arguments and the other has three arguments. When there are two arguments in a function call the first definition applies. When there are three arguments in a function call the second definition applies. Overloading a Function Name If you have two or more function definitions for the same function name that is called overloading. When you overload a function name the function definitions must have different numbers of formal parameters or some formal parameters of different types. When there is a function call the compiler uses the function definition whose number of formal parameters and types of formal parameters match the arguments in the function call. determining which definition applies Whenever you give two or more definitions to the same function name the various function definitions must have different specifications for their arguments that .
TÀI LIỆU LIÊN QUAN
Absolute C++ (4th Edition) part 85
Absolute C++ (4th Edition) part 1
Absolute C++ (4th Edition) part 2
Absolute C++ (4th Edition) part 3
Absolute C++ (4th Edition) part 4
Absolute C++ (4th Edition) part 5
Absolute C++ (4th Edition) part 6
Absolute C++ (4th Edition) part 7
Absolute C++ (4th Edition) part 8
Absolute C++ (4th Edition) part 9
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.