ANSI/ISO C++ Professional Programmer's Handbook phần 4

Tham khảo tài liệu 'ansi/iso c++ professional programmer's handbook phần 4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | ANSI ISO C Professional Programmer s Handbook - 4 - Special Copy Constructor Destructor And Assignment Operator Covariance of Virtual Member Functions The implementation of virtual constructors relies on a recent modification to C namely virtual functions covariance. An overriding virtual function has to match the signature and the return type of the function it overrides. This restriction was recently relaxed to enable the return type of an overriding virtual function to co-vary with its class type. Thus the return type of a public base can be changed to the type of a derived class. The covariance applies only to pointers and references. CAUTION Please note that some compilers do not support virtual member functions covariance yet. Assignment Operator A user-declared assignment operator of class C is a nonstatic nontemplate member function of its class taking exactly one argument of type C C const C volatile C or const volatile C . Implicitly-Defined Assignment Operator If there is no user-defined assignment operator for a class the implementation implicitly declares one. An implicitly-declared assignment operator is an inline public member of its class and it has the form C C operator const C if each base class of C has an assignment operator whose first argument is a reference to a const object of base class type and if all the nonstatic embedded objects in C also have an assignment operator that takes a reference to a const object of their type. Otherwise the implicitly-declared assignment operator is of the following type C C operator C An implicitly-declared assignment operator has an exception specification. The exception specification contains all the exceptions that might be thrown by other special functions that the assignment operator invokes directly. An assignment operator is said to be trivial if it is implicitly declared if its class has no virtual member functions or virtual base classes and if its direct base classes and embedded .

Không thể tạo bản xem trước, hãy bấm tải xuống
Đã 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.