D Programming/Expressions

From Wikibooks, open books for an open world
Jump to navigation Jump to search

new[edit | edit source]

The keyword new allocates the memory for an object and calls one of the constructors.

class C{
}
C c = new C();

This allocates as many bytes, the class C needs for one instance. Then the standard constructor without arguments is called.

If the memory allocation fails, an OutofMemory Exception is thrown. The memory is allocated on the garbage collector heap.

A class can have multiple constructors with different argument lists. The matching constructor is chosen.

A class can have an own allocator and deallocator. If they exist, they are called instead of the gc allocator.

in[edit | edit source]

To do:

cast[edit | edit source]

To do:

assert[edit | edit source]

To do:

typeid[edit | edit source]

To do:

is[edit | edit source]

To do:

delete[edit | edit source]

To do: