Navigation:  Reference > Classes > TXbClass() >

TXbClass():New( cClsName ) -> Self

Previous pageReturn to chapter overviewNext page

EXPORTED CLASS METHOD - Create a new instance of the TXbClass helper class

 

TXbClass():New( cClsName )  -> Self

 

<cClsName>

Name of the new Dynamic class to be defined

 

IMPORTANT NOTE: 

 

You must call the   ::Destroy()   method when the helper object is no longer required, 

in order to release internal allocated resources and memory.

 

The "normal" life-cycle of the TXbClass() object will the following:

 

function MyClass()

   local oClsObj := ClassObject( "MyClass" )

   local ooo

   if oClsObj != NIL

      return oClsObj

   endif

   ooo := TXbClass():New( "MyClass" )

   ooo:_Parent( "MyParent" )

   ooo:_AddMethod( "Sum" , {|self,a,b| a + b }   )

   ooo:_AddMethod( "Rest" , "{|self,a,b| a - b }"  )

   .... more methods and vars ....

   oClsObj := ooo:Create()

   ooo:Destroy()  

   if oClsObj == NIL

      .......  add some error handling here

   endif

return oClsObj