Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Harbour Version 0.37 (c) reference Guid - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

CLASS

Define a Class for Object Oriented Programming
---------------------------------------------------------------------------------

 Syntax

        [CREATE] CLASS <ClassName> [ <FROM, INHERIT> <SuperClass1>
      [,<SuperClassN>] ]  [STATIC]

 Arguments

        <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.

      
         EXPORTED:
         VISIBLE:
         HIDDEN:
         PROTECTED:
      
      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).

 Examples

  
      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
  

Status

      Ready

 Compliance

      CLASS is a Harbour extension.

 Platforms

      All



See Also: TClass() Object Oriented Programming DATA METHOD

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson