[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  DELEGATE MESSAGE               Delegate Messages to embedded Objects
------------------------------------------------------------------------------


 SYNTAX:

  DELEGATE MESSAGE <cMsgs,...> ; 
        TO <oVar> [<postScope>]  


 PARAMETER:

  <postScope>  Specifies the visibility of the Message. 
               Please press  Related Topics:  and select  METHOD  for
               more detailed informations about method scopes


  <cMsg..>     Are the Message(s) that will be forwarded to the embedded
               <oVar> TargetObject 

  <oVar>       Is the InstanceVar that contains the Object to receive the
               forwarded messages



 DESCRIPTION:

  This command causes the specified message(s) to be forwarded to the object
  referred to by the specified target variable <oVar>. This allows messages
  to be redirected automatically without requiring methods to be written.
  In FiveWin, many controls delegate messages to the embedded Clipper-Get 
  Object oGet ( although, for whatever reason, this is not done via 
  Delegation ... )


  On the second sight, DELEGATION is an alternative to Inheritance. In fact,
  there are OOP Implementations that use Delegation to provide Inheritance..  
  The big advantage is that we can forward messages to a special object :

  Let's take a Table object for example. There are no two identical table 
  objects in a database( there can't be two identical tables with the same
  name .. ), so with Inheritance there is no way to inherite from _that_
  table object. We would always create a new table object .. 

  So the way to go is : take _that_ table object, put it into a instanceVar
  of our new class, and delegate all relating messages to that table object.


  That gives us a third sight : Delegation gives us the possibility to have
  mulitple Inheritance ! just put every parent object in an InstanceVar slot,
  and delegate the appropriate messages to it .....



 EXAMPLE:


    +--------------------------------------------------------------+
    |  /* Delegation Example */                                    |
    |  CREATE CLASS dbServer                                       |
    |  ...                                                         |
    |  VAR oTable                                                  |
    |  ...                                                         |
    |  DELEGATE ;                                                  |
    |   MESSAGE Select, close, open, area TO oTable                |
    |                                                              |
    +--------------------------------------------------------------+




See Also: Method Create Class
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson