Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Fast Library For Clipper 3.02 Reference - <b>class</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
    CLASS

         Creates a new Class with its new Methods and Instances

    Syntax:


    CLASS DEFINITION

         #include "Objects.ch"

         CLASS ClassName [ FROM SuperClass1 [, SuperClassN ] ]

           DATA DataName1  [, DataNameN ]

           METHOD MethodName( [ Param1 [, ParamN ] ] ) CONSTRUCTOR

           METHOD MethodName( [ Par1 [, ParN ] ] ) BLOCK ;
                      { | Self [, Par1 [, ParN ] ] | Actions, , , }

           METHOD MethodName( [ Par1 [, ParN ] ] ) SETGET

           METHOD MethodName( [ Par1 [, ParN ] ] ) VIRTUAL

           METHOD MethodName( [ Par1 [, ParN ] ] )

         ENDCLASS


    METHOD DEFINITION

         METHOD MethodName( Par1, Par2, ... ) CLASS ClassName

              ...

              [ ::Parent:New( Par1, Par2, ... ) ]

              ...

              ::DataName1 := ...

              ...

              ::MethodName( ... )

              ...

              Return  [ Return Value ]


         CLASS       : Indicates the start of a class definition
         FROM        : Determines if the class must receive the methods and
                       instances from other class that will be superclass or
                       master class.
         DATA        : Allows define instances or internal variables from the
                       class.
         METHOD      : Allows define methods of the class.
         CONSTRUCTOR : Indicates the constructor method of the class.
         BLOCK       : Allows define a method like a codeblock.
         VIRTUAL     : Allows define empty methods.
         ENDCLASS    : Marks the end of the definition of the class.


    Description:

         Allows define new classes in Clipper. You must access to the non-
         documented functions of the SEND module.
         The Methods and Instances of the new class will be all defined in
         the moment of creation anyway all that they have the superclass
         from wich receive the current in case that a FROM sentence has
         been defined

    Return:

         Not available.

    Example:

         Function oDemo()
         Local oPrueba := TDemo():New( 33, 10 )
             oPrueba:cMess := "Welcome to Fast Library"
             oPrueba:SetClr := "W/B"
             oPrueba:Message()
         Return ( Nil )

         CLASS TDemo
             DATA   nPosX
             DATA   nPosY
             DATA   cMens
             DATA   cClr
             METHOD New( nY, nX ) CONSTRUCTOR
             METHOD Message()
             METHOD SetClr( cC ) BLOCK { | Self, cC | ::cClr := cC }
         ENDCLASS

         METHOD Function New( nY, nX )
             ::nPosY := nY
             ::nPosX := nX
         Return( Self )

         METHOD Function Mess()
             @ ::nPosY, ::nPosX Say ::cMess Color ::cClr
         Return( Self )

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