Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Child.pcount() ?
Message
De
10/07/2003 17:59:56
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00809000
Message ID:
00809050
Vues:
25
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.

>Nope. The only way I know of is from the child:
>
>dodefault(t1, t2, pcount())
>
>and have the parent accept 3 parameters. Or store the pcount() to an object property and have the parent check that value.
>
Bill Morris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform