TAILIEUCHUNG - D Programming Language PHẦN 5

được thực hiện, và f là một tham chiếu đến một ví dụ lớp có một deallocator, deallocator được gọi với một con trỏ đến cá thể lớp sau khi destructor (nếu có) cho các lớp học được gọi là. Đây là trách nhiệm của deallocator miễn phí bộ nhớ. Lớp thừa kế thừa bất kỳ deallocator từ lớp cơ sở của họ, nếu không phải là quy định. | The D Programming Language new 1 2 Foo a calls new 1 2 Derived classes inherit any allocator from their base class if one is not specified. See also Explicit Class Instance Allocation. Class Deallocators A class member function of the form delete void p . is called a class deallocator. The deallocator must have exactly one parameter of type void . Only one can be specified for a class. When a delete expression delete f is executed and f is a reference to a class instance that has a deallocator the deallocator is called with a pointer to the class instance after the destructor if any for the class is called. It is the responsibility of the deallocator to free the memory. Derived classes inherit any deallocator from their base class if one is not specified. See also Explicit Class Instance Allocation. Auto Classes An auto class is a class with the auto attribute as in auto class Foo . The auto characteristic is inherited so if any classes derived from an auto class are also auto. An auto class reference can only appear as a function local variable. It must be declared as being auto auto class Foo . void func Foo f error reference to auto class must be auto auto Foo g new Foo correct When an auto class reference goes out of scope the destructor if any for it is automatically called. This holds true even if the scope was exited via a thrown exception. Interfaces InterfaceDeclaration 93 The D Programming Language interface Identifier InterfaceBody interface Identifier SuperInterfaces InterfaceBody SuperInterfaces Identifier Identifier SuperInterfaces InterfaceBody DeclDefs Interfaces describe a list of functions that a class that inherits from the interface must implement. A class that implements an interface can be converted to a reference to that interface. Interfaces correspond to the interface exposed by operating system objects like COM OLE ActiveX for Win32. Interfaces cannot derive from classes only from other interfaces. Classes cannot derive from an .

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.