__declspec(dynamic)

From RAD Studio
Jump to: navigation, search

Go Up to Keywords, Alphabetical Listing Index


Category

Modifiers (C++), Keyword Extensions, Storage Class Specifiers (C++)

Syntax

__declspec(dynamic) declarator

The dynamic argument is used in the declarations of dynamic functions. Dynamic functions are similar to virtual functions, except that they are stored only in the vtables for the objects that define them, not in descendent vtables. If you call a dynamic function, and that function is not defined in your object, the vtables of its ancestors are searched until the function is found.

You can use dynamic functions instead of virtual functions to reduce the code size, but the dynamic dispatch may take longer.

Dynamic functions are only valid for classes derived from TObject.

Note: You can use the macro DYNAMIC, defined in sysmac.h, as an alternative for __declspec(dynamic).

See Also