Class Virtual Functions

From RAD Studio
Jump to: navigation, search

Go Up to C++ and Delphi Class Models


Class virtual methods are virtual methods tagged with the __classmethod modifier. They are invoked via the VMT, but the this pointer is the metaclass pointer, not an object instance as for non-class virtuals.

Use the __classmethod keyword to declare class methods in C++. The modifier __classmethod indicates that a function may be invoked on a class name -- as well as on an instance of that class.

Note: C++Builder also supports virtual __classmethod members, and you can invoke these methods from C++.
For a code snippet that shows how to use the __classmethod keyword, see Class Methods Using __classmethod Keyword.


See Also