| xHarbour Reference Documentation > Statement Reference |
![]() |
![]() |
![]() |
Declares a method as virtual.
METHOD <MethodName> VIRTUAL|DEFERRED
The METHOD...VIRTUAL statement can only be used in the class declaration between CLASS and ENDCLASS. It declares the symbolic name of a virtual method.
A virtual method is a method that is declared in a class but not implemented. The implementation of such method is deferred to a sub-class. Consequently, virtual methods are only used with inheritance where sub-classes are derived from super classes. By means of virual methods a programmer can define the "message profile" within a class hierarchy at a very early point of the development cycle. An object having virtual methods understands the corresponding message but does not execute code.
| See also: | CLASS, DELEGATE |
| Category: | Class declaration , Declaration , xHarbour extensions |
| Header: | hbclass.ch |
| Source: | vm\classes.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
http://www.xHarbour.com