Lecture note Data visualization - Chapter 13

In this lecture we learned about: Separation of interface and implementation, objects are declared as primitive type, the destructor operator, copy constructor, default constructor. | Lecture 13 Recap Separation of Interface and Implementation Objects are Declared as Primitive Type The Destructor Operator Copy Constructor Default Constructor Selective Questions from Exercise Q: What is information hiding? What is encapsulation? How does C++ support these concepts? Answer: Information hiding makes implementation details, including components of an object, inaccessible. Encapsulation is the grouping of data and the operations that apply to them to form an aggregate while hiding the implementation of the aggregate. Encapsulation and information hiding are achieved in C++ through the use of the class. Q: Explain the public and private sections of the class. Answer: Members in the public section of a class are visible to non-class routines and can be accessed via the. member operator. Private members are not visible outside of the class. Q: Describe the roles of the constructor and destructor. Answer: The constructor is called when an object is created, either by . | Lecture 13 Recap Separation of Interface and Implementation Objects are Declared as Primitive Type The Destructor Operator Copy Constructor Default Constructor Selective Questions from Exercise Q: What is information hiding? What is encapsulation? How does C++ support these concepts? Answer: Information hiding makes implementation details, including components of an object, inaccessible. Encapsulation is the grouping of data and the operations that apply to them to form an aggregate while hiding the implementation of the aggregate. Encapsulation and information hiding are achieved in C++ through the use of the class. Q: Explain the public and private sections of the class. Answer: Members in the public section of a class are visible to non-class routines and can be accessed via the. member operator. Private members are not visible outside of the class. Q: Describe the roles of the constructor and destructor. Answer: The constructor is called when an object is created, either by declaration, a call to new, or as a member of an object which itself is being constructed. The destructor is called when the object exits scope, either because it is a local variable in a terminating function, it is subject to a delete, or it is a member of an object whose destructor is called. Q: What is the difference between a copy constructor and a copy assignment operator? Answer: The copy constructor creates and initializes a new object. It is used to implement call by value. The copy assignment operator copies into an already existing object. Q: If a class provides no constructor and no destructor, what is the result? Answer: The default constructor is a member-by-member application of a default constructor. The default destructor is a member-by-member application of a destructor. Chapter 4 Inheritance Introduction In this chapter we will study how the general principles of inheritance and the object-oriented concept of polymorphism relate to code reuse, how inheritance is .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
72    100    3    01-05-2024
Đã 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.