TAILIEUCHUNG - Absolute C++ (4th Edition) part 25

Absolute C++ (4th Edition) part 25. 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. . | Classes 243 A programmer who uses a class also should not need to know how the data of the class is implemented. The implementation of the data should be as hidden as the implementation of the member functions. In fact it is close to impossible to distinguish between hiding the implementation of the member functions and the implementation of the data. To a programmer the class DayOfYear Display has dates as data not numbers. The programmer should not know or care whether the month March is implemented as the int value 3 the quoted string March or in some other way. Defining a class so that the implementation of the member functions and the implementation of the data in objects are not known or is at least irrelevant to the programmer who uses the class is known by a number of different terms. The most common terms used are information hiding data abstraction and encapsulation each of encapsu-which means that the details of the implementation of a class are hidden from the pro- lation grammer who uses the class. This principle is one of the main tenets of object-oriented programming OOP . When discussing OOP the term that is used most frequently is encapsulation. One of the ways to apply this principle of encapsulation to your class definitions is to make all member variables private which is what we discuss in the next subsection. PUBLIC AND PRIVATE MEMBERS Look back at the definition of the type DayOfYear given in Display . In order to use that class you need to know that there are two member variables of type int that are named month and day. This violates the principle of encapsulation information hiding that we discussed in the previous subsection. Display is a rewritten version of the class DayOfYear that better conforms to this encapsulation principle. Notice the words private and public in Display . All the items that follow the word private in this case the member variables month and day are said to be private private which means that they .

TỪ KHÓA LIÊN QUAN
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.