Đang chuẩn bị liên kết để tải về tài liệu:
Chapter 11 Separate Compilation and Namespaces

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

All code goes in some namespace Unless specified global namespace, No need for using directive. Global namespace always available, Implied "automatic" using directive | Chapter 11 Separate Compilation and Namespaces Learning Objectives Separate Compilation Encapsulation reviewed Header and implementation files Namespaces using directives Qualifying names Unnamed namespaces Hiding helping functions Nested namespaces Separate Compilation Program Parts Kept in separate files Compiled separately Linked together before program runs Class definitions Separate from "using" programs Build library of classes Re-used by many different programs Just like predefined libraries Class Separation Class Independence Separate class definition/specification Called "interface" Separate class implementation Place in two files If implementation changes only that file need be changed Class specification need not change "User" programs need not change Encapsulation Reviewed Encapsulation principle: Separate how class is used by programmer from details of class’s implementation "Complete" separation Change to implementation NO impact on any other programs Basic OOP . | Chapter 11 Separate Compilation and Namespaces Learning Objectives Separate Compilation Encapsulation reviewed Header and implementation files Namespaces using directives Qualifying names Unnamed namespaces Hiding helping functions Nested namespaces Separate Compilation Program Parts Kept in separate files Compiled separately Linked together before program runs Class definitions Separate from "using" programs Build library of classes Re-used by many different programs Just like predefined libraries Class Separation Class Independence Separate class definition/specification Called "interface" Separate class implementation Place in two files If implementation changes only that file need be changed Class specification need not change "User" programs need not change Encapsulation Reviewed Encapsulation principle: Separate how class is used by programmer from details of class’s implementation "Complete" separation Change to implementation NO impact on any other programs Basic OOP principle Encapsulation Rules Rules to ensure separation: All member variables should be private Basic class operations should be: Public member functions Friend or ordinary functions Overloaded operators Group class definition and prototypes together Called "interface" for class Make class implementation unavailable to users of class More Class Separation Interface File Contains class definition with function and operator declarations/prototypes Users "see" this Separate compilation unit Implementation File Contains member function definitions Separate compilation unit Class Header Files Class interface always in header file Use .h naming convention Programs that use class will "include" it #include "myclass.h" Quotes indicate you wrote header Find it in "your" working directory Recall library includes, e.g., indicate predefined library header file Find it in library directory Class Implementation Files Class implementation in .cpp file Typically give interface file and .

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.