đượ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 .