Avaliação do Usuário

Estrela inativaEstrela inativaEstrela inativaEstrela inativaEstrela inativa
 

CLASS

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 VAR 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 VAR 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 VAR 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)
CREATE CLASS TBColumn
   VAR Block      // Code block to retrieve data for the column
   VAR Cargo      // User-definable variable
   VAR ColorBlock // Code block that determines color of data items
   VAR ColSep     // Column separator character
   VAR DefColor   // Array of numeric indexes into the color table
   VAR Footing    // Column footing
   VAR FootSep    // Footing separator character
   VAR Heading    // Column heading
   VAR HeadSep    // Heading separator character
   VAR Width      // Column display width
   VAR ColPos     // Temporary column position on screen
   METHOD New()    // Constructor
ENDCLASS
Status
Ready
Compliance
This is Harbour specific
Platform(s)
This is available on all platforms
See also

HBClass(), Object Oriented Programming, VAR, METHOD