TAILIEUCHUNG - Encapsulation and Abstraction

Objects contain data and methods to send and receive messages. Data members of objects can have a different scope or visibility. You use access specifier to define the scope of data member and method. This chapter introduces the concept of abstraction and encapsulation. It discusses the implementation of encapsulation by using access specifiers. It also explains the concept of using methods. In addition, the chapter also discusses the static variables and static functions. | Encapsulation and Abstraction Chapter 4 Objects contain data and methods to send and receive messages. Data members of objects can have a different scope or visibility. You use access specifier to define the scope of data member and method. This chapter introduces the concept of abstraction and encapsulation. It discusses the implementation of encapsulation by using access specifiers. It also explains the concept of using methods. In addition the chapter also discusses the static variables and static functions. Objectives In this chapter you will learn to fl Define abstraction and encapsulation fl Implement encapsulation by using access specifiers fl Use methods fl Use static variables and static functions Introducing Abstraction and Encapsulation Abstraction and encapsulation are important features of any OOPs language. Abstraction involves extracting only the relevant information. Encapsulation involves packaging one or more components together. Defining Abstraction Consider the following example An automobile salesperson is aware that different people have different preferences. Some people are interested in the speed of a car some in its price some in the engine and the some in its style. Although all of them want to buy a car each of them is interested in a specific attribute or feature. The salesman knows all the details of a car but he presents only the relevant information to a potential customer. As a result the salesman practices abstraction and presents only relevant details to customer. In other words abstraction means looking for what you want in an object or a class. Consider abstraction from the perspective of a programmer who wants a user to be able to add items to a list. However the detail of how a particular task in a program is accomplished is hidden. Abstraction does not mean that information is unavailable. It means that all the information exists but only the relevant information is provided to the user. Defining Encapsulation Encapsulation .

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.