xHarbour Reference Documentation > Statement Reference xHarbour Developers Network  

METHOD...VIRTUAL

Declares a method as virtual.

Syntax

METHOD <MethodName> VIRTUAL|DEFERRED

Arguments

<MethodName>
This is the symbolic name of the method to declare. It must begin with a letter or underscore followed by digits, letters or underscores. The symbolic name can contain up to 63 characters.
DEFERRED
This is a synonym for VIRTUAL.

Description

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.

Info

See also:CLASS, DELEGATE
Category: Class declaration , Declaration , xHarbour extensions
Header:hbclass.ch
Source:vm\classes.c
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe