TAILIEUCHUNG - Polymorphism

Polymorphism is the ability that helps in executing different operations in response to the same message. In OOP, you can implement polymorphism by creating more than one function within a class that have the same name. The difference in the functions lies in the number and the types of parameters passed to each function. This chapter introduces the concept of polymorphism. It explains how to implement function overloading and operator overloading. | Polymorphism Polymorphism is the ability that helps in executing different operations in response to the same message. In OOP you can implement polymorphism by creating more than one function within a class that have the same name. The difference in the functions lies in the number and the types of parameters passed to each function. This chapter introduces the concept of polymorphism. It explains how to implement function overloading and operator overloading. Objectives In this chapter you will learn to fl Describe polymorphism fl Implement function overloading fl Implement operator overloading Chapter 7 Introducing Polymorphism The term polymorphism was derived from the Greek words poly and morphos which mean many and forms respectively. In OOP polymorphism is often expressed by the phrase one interface multiple functions . This expression means that polymorphism allows one interface to be used for multiple functions. You can apply polymorphism for reducing the complexity within the functions of a class of your program. Polymorphism can either be static or dynamic. In static polymorphism the response to a function is decided at compile time. In dynamic polymorphism the response to the function is decided at run time. Static Polymorphism Static polymorphism refers to an entity which exists in various forms simultaneously. The concept of static polymorphism is analogous to the role of a woman who can be a wife a mother a daughter a sister and an executive at the same time. The mechanism of linking a function with an object during compile time is called early binding. It is also known as static binding. C uses two approaches to implement static polymorphism. These are Function Overloading Operator Overloading Function Overloading This approach allows using the same name for two or more functions. Each redefinition of a function must use different types of parameters sequence of parameters or a number of parameters. The type sequence or number of parameters for a .

TÀI LIỆU MỚI ĐĂNG
31    248    0    26-04-2024
19    228    0    26-04-2024
34    212    1    26-04-2024
8    173    0    26-04-2024
20    198    2    26-04-2024
15    183    0    26-04-2024
23    155    0    26-04-2024
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.