Hi Dave, thank you for your interest.bpd2000 wrote:What is class
What I know CLASSES are made in OOP (Object Oriented Programming) and I really do not know many about OOP neither in Harbour.
In HMG you will not find many CLASSES, basically you will find some examples in MySQL connectivity and:
- C:\hmg.3.3.1\SOURCE\h_tole.prg (TOLEAUTO)
C:\hmg.3.3.1\SOURCE\hbvpdf\hbvpdft.prg (tPdf)
C:\hmg.3.3.1\SOURCE\Report\H_REPORT.PRG (_HMG_REPORT)
C:\hmg.3.3.1\SOURCE\Report\TPRINT.PRG (TPRINT)
C:\hmg.3.3.1\SAMPLES\HFCL\SQL\MySQL\MYSQL_3\demo.prg (TMySQLServer)
According "Harbour guide" (FiveTechSoft):
Harbour Extensions
Language extensions - Description:
- Class generation and management.
CA-Cl*pper only allowed creation of objects from a few standard classes.
In Harbour, you can create your own classes--complete with Methods, Instance Variables, Class Variables and Inheritance. Entire applications can be designed and coded in Object Oriented style. - @<FunctionName>()
Returns the pointer (address) to a function.
The returned value is not useful to application-level programming, but is used at a low level to implement object oriented coding. (Internally, a class method is a static function and there is no symbol for it, so it is accessed via its address). - Class HBGetList
Object oriented support for GetLists management. - ProcName() support for class Method names.
Class Methods can be retrieved from the call stack.
Define a Class for Object Oriented Programming
Syntax
[CREATE] CLASS <ClassName> [ <FROM, INHERIT> <SuperClass1> [, <SuperClassN>] ] [STATIC]
Argument(s)
<ClassName> Name of the class to define. By tradition, Harbour
classes start with "T" to avoid collisions with user- created classes.
<SuperClass1...n> The Parent class(es) to use for inheritance.
Harbour supports Multiple Inheritance.
STATIC This clause causes the class function to be declared
as a static function. It will therefore not be available outside the current module.
Description
CLASS creates a class from which you can create objects. The CLASS command begins the class specification, in which the DATA elements (also known as instance variables) and METHODS of the class are named. The following scoping commands may also appear. They control the default scope of DATA and METHOD commands that follow them.
<fixed>
EXPORTED: VISIBLE: HIDDEN: PROTECTED:
</fixed> The class specification ends with the END CLASS command.
Classes can inherit from multiple <SuperClasses>, and the chain of inheritance can extend to many levels.
A program uses a Class by calling the Class Constructor, usually the New() method, to create an object. That object is usually assigned to a variable, which is used to access the DATA elements and methods.
Harbour's OOP syntax and implementation supports Scoping (Protect, Hidden and Readonly) and Delegating, and is largely compatible with Class(y)(tm), TopClass(tm) and Visual Objects(tm).
Example(s)
CLASS TBColumn
DATA Block // Code block to retrieve data for the column
DATA Cargo // User-definable variable
DATA ColorBlock // Code block that determines color of data items
DATA ColSep // Column separator character
DATA DefColor // Array of numeric indexes into the color table
DATA Footing // Column footing
DATA FootSep // Footing separator character
DATA Heading // Column heading
DATA HeadSep // Heading separator character
DATA Width // Column display width
DATA ColPos // Temporary column position on screen
METHOD New() // Constructor
ENDCLASS
According "Harbour Reference Guide" (Giovanni Di Maria):
HBCLASS
According "Harbour for beginners" (Alexander Kresin):
3.3 Classes and objects
There is also this topic from our maestro Roberto Lopez which explain about OOP in HMG.
Why this kind of class (TAutoGet) is not already in HMG (is this your question and mean ?)bpd2000 wrote:... why it is not in HMG
I do not know, probably we have to promote for having at HMG. Maybe do not need to be as OOP and been as simple function ? I do not know.
Probably HMG Development Team would response this question
My wish, I have already posted.