BASIC FEATURES: 


o Full object oriented architecture. The class creation functions are a
true Clipper object ( class _OBJECT_ ).

o Code block assignments to IVars and Methods for faster, cleaner code

o Inline Code assignments to IVars for even faster, cleaner code

o Full Inheritance of INLINE/BLOCK Methods and IVars.

o 100% Debugger suport using STATIC Methods.

o Allows IVars to be given default values at class creation. Less code when writing the constructor function.

o Allows new IVars and database fields to be declared on the fly at runtime using ::InsData()

o Supports Multiple inheritance, Encapsulation & Polymorphism.

o Supports Class Dictionary ( self:dict ) as an object.

o Implements ::super

o Supports class ALIAS for easy access to parent methods as well as ::super(CLASSNAME):cMsg internal method (oClip and oOClip compatibility)

o Supports VIRTUAL Methods

o Supports LINKed Methods

o Supports User defined GETSET data functions.

o Supports EXCUDE clause in order to remove unwanted methods and IVars from inherited classes

o Supports class inspection method o:classInfo() for every class.

o Supports READONLY, LOCAL and VIRTUAL variable scoping

o Full compatibility with oClip and oOClip class libraries, some compatibility with Class(y) and OBJECTS 1.00 - 4.00

o Enhanced example code and real world classes.

o Supports STATIC Methods and Reusable Method UDFs.

o Supports full Inheritance of Clipper's native classes and foreign classes that use Clipper's class creation system.

o Supports one line subclassing of object instance variables.

OVERVIEW : 


OBJECTS AND OOBJECT:
------------------------------


To write new classes with oObject (also called UDOs, User Defined Objects), you must follow a few guidelines. Actually these guidelines are 99% common to most class libraries ( like Class(y), TopClass, Objects etc.) so you don't have to really change the way you write your classes. Infact, oObject syntax and command set is very close to most class libraries, so in most cases you won't have to change a single line.

a) Declare the Class

1) Create the class and define its Super class if any. Every class must be issued a unique ALIAS that we will use when calling super methods that share the same name as the ones in our class:

CLASS Box ALIAS Box // Super class
<code...>
ENDCLASS

CLASS Window FROM Box ALIAS oW
or
CREATE CLASS Window INHERIT Box ALIAS oW // Child class
<code...>
ENDCLASS

This way, class BOX ::display() method will be ::BoxDisplay() in the WINDOW class if the WINDOW class also has a ::display() method otherwise, ::display() will be transferred to class WINDOW as is.

2) Declare Instance Variables and assign default values to them.

I) Simple IVars

DATA nTop, nLeft, nBottom, nRight AS INT

II) INLINE IVars - combined Data & Code

DATA Recno( n ) INLINE ;
IF( n == NIL, (::Alias)->(Recno()),;
(::Alias)->(dbGoto(n))
III) Special GET/SET IVars

IV) LINKed IVars


3) Declare the Methods for the class.

I) PUBLIC Methods

// These point to a PUBLIC function _WinDisplay()
METHOD Display = _WinDisplay
MESSAGE Display METHOD _WinDisplay

II) STATIC Methods - Notice parameter passing at class init.

METHOD Display( lRefresh )
METHOD Move( nRows, nCols )

III) INLINE Methods

METHOD Dispgets() INLINE ;
Aeval( ::GetList, {|e| e:Display() })


4) Insert the new class using the ENDCLASS command.


b) Define one or more constructor Methods. Constructor Methods may be PUBLIC or STATIC depending on the way they were defined during class declaration (see above). They must initialize the class by accepting
some parameters and assigning them to the class IVars.

Most times the Constructor Method will be called NEW() or INIT() and it MUST return Self - and so must all Methods that don't return anything meaningful. In the constructor function we must also call the super
classes constructor Method - if any.

//METHOD New( nTop, nLeft, nBottom, nRight) // STATIC Method
METHOD FUNCTION _WinNew( nTop, nLeft, nBottom, nRight) // PUBLIC Method
DEFAULT nTop := 0
DEFAULT nLeft := 0
DEFAULT nBottom := 0
DEFAULT nRight := 0
::nTop := nTop
::nLeft := nLeft
::nBottom := nBottom
::nRight := nRight

::Super:New( ::nTop, ::nLeft, ::nBottom, ::nRight )
// or ::BoxNew(::nTop, ::nLeft, ::nBottom, ::nRight)
RETURN self


c) Define the Methods of the new Class. Methods may be PUBLIC or STATIC depending on the way they were defined during class declaration (see above). If a Method does not return anything useful, like calculated
data, it is absolutely necessary to return self. This way we allow Method chaining:

oTbrowse:ForceStable():RefreshAll():RefreshCurrent()

METHOD Display( lRefresh ) //STATIC Function
METHOD FUNCTION _WinDisplay( lRefresh ) //PUBLIC Function
<code...>
<code...>
<code...>
RETURN self

d) To call a new window object from within your code use:

LOCAL o := Window():New( 10,10,20,30):Display()

or...

LOCAL o := Window()
o:New( 10,10,20,30)
o:Display()


                                                                                                                           

Hosted by www.Geocities.ws

1