Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Child.pcount() ?
Message
 
 
À
10/07/2003 17:59:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00809000
Message ID:
00809298
Vues:
22
I don't see anything wrong with what you propose to do especially since VFP propagates the LPARAMETER statements of parent classes down to subclasses when you edit an empty method.

>Hi Mark,
>Thanks. That gave me an idea.
>
>What I'm concerned about is not realizing that the parent-class is checking pcount() when I create/edit a sub-class.
>Do you see anything wrong with this?
>
>class.method()
>  lparameters t1, t2, tpcount
>  if vartype(tpcount) # 'N'
>    ** object created from this class
>    **   or sub-class with no code in method()
>    tpcount = pcount()
>  else
>    ** object created from a sub-class
>    **   with code in it's method()
>  endif
>  if tpcount = 2
>    ..... <code>
>  endif
>
>sub-class.method()
>  lparameters t1, t2, tpcount       && no code in this one, so it just passes it on
>
>sub-sub-class.method()
>  lparameters t1, t2, tpcount
>  ..... <code>
>  if vartype(tpcount) # 'N'
>    ** object created from this class
>    **   or sub-class with no code in method()
>    tpcount = pcount()
>  else
>    ** object created from a sub-class of this class
>    **   with code in it's method()
>  endif
>  dodefault( t1, t2, tpcount )
>
>my1stObject = createobject( 'sub-class' )
>  = my1stObject.method( v1 )        && class.method() should receive tpcount=.F. and pcount()=1
>
>my2ndObject = createobject( 'sub-sub-class' )
>  = my2ndObject.method( v1 )        && class.method() should have tpcount=1
>  = my2ndObject.method( v1, v2 )    && class.method() should have tpcount=2
>
>
>Since I would see that the 3rd parameter was named tpcount, it would remind me to check for tpcount passed from a future sub-class and pass tpcount or pcount() up the line.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform