Đang chuẩn bị liên kết để tải về tài liệu:
Object oriented programming with C++ - Session 3 Function Overloading and References

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

Understand the concept of functions with default arguments Define and use Friend functions advantages disadvantage friend classes Describe function overloading various data types different number of arguments | Function Overloading and References Session 3 Session Objectives Understand the concept of functions with default arguments Define and use Friend functions advantages disadvantage friend classes Describe function overloading various data types different number of arguments Object Oriented Programming with C++/ Session 3/ of 35 Session Objectives (Contd.) describe the scope for function overloading Explain the use of reference arguments passing references to functions returning references from functions Define and use Inline functions Object Oriented Programming with C++/ Session 3/ of 35 Functions A function declaration gives: the name of the function the type of the value returned (if any) by the function the number and types of the arguments that must be supplied in a call of the function A function declaration may or may not contain argument names. Possible to call a function without specifying all its arguments. Object Oriented Programming with C++/ Session 3/ of 35 . | Function Overloading and References Session 3 Session Objectives Understand the concept of functions with default arguments Define and use Friend functions advantages disadvantage friend classes Describe function overloading various data types different number of arguments Object Oriented Programming with C++/ Session 3/ of 35 Session Objectives (Contd.) describe the scope for function overloading Explain the use of reference arguments passing references to functions returning references from functions Define and use Inline functions Object Oriented Programming with C++/ Session 3/ of 35 Functions A function declaration gives: the name of the function the type of the value returned (if any) by the function the number and types of the arguments that must be supplied in a call of the function A function declaration may or may not contain argument names. Possible to call a function without specifying all its arguments. Object Oriented Programming with C++/ Session 3/ of 35 Functions with default arguments The function declaration must provide default values for those arguments that are not specified. Whenever a call is made to a function without specifying an argument, the program will automatically assign values to the parameters from the default declaration. void func(int = 1, int = 3, char = '*'); //prototype declaration or void func(int num1,int num2 = 3,char ch = '*'); Object Oriented Programming with C++/ Session 3/ of 35 Default values for arguments Once an argument is given a default value in the list of formal arguments, all of the remaining must have default values also. Only the trailing values can be defaulted. void func(int num1=2,int num2, char ch='+'); //error Default values must be of the correct types or the compiler will issue an error. Default values can be given in either the prototype or the function definition header, but not in both. Highly recommended that the default values be given in the prototype declaration rather than in .

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.