[<<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 this class must receive the methods and
                       instances from other class that serve as the superclass
                       or master class.
         DATA        : Define instances or internal variables of the class.
         METHOD      : Define methods of the class.
         CONSTRUCTOR : Indicates the constructor method of the class.
         BLOCK       : Define a method like a codeblock.
         VIRTUAL     : Define empty methods.
         ENDCLASS    : Marks the end of the definition of the class.


    Description:

         Define new classes in Clipper. You must access the non-
         documented functions of the SEND module.
         All Methods and Instances of the new class will automatically be
         defined upon creation and will inherit from the superclass if the
         FROM statement is invoked.  If you're unfamiliar with the Clipper
         SEND syntax, help is very often available from the power users that
         congregate on Compuserve's Clipper forum.  It is beyond the scope of
         this document to teach OOPS.

    Return:

         Not available.

    Example:

         Function oDemo()
         Local oTest := TDemo():New( 33, 10 )
             oTest:cMess := "Welcome to FAST.lib"
             oTest:SetClr := "W/B"
             oTest: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 )

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson