Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Skipping inheritance
Message
De
08/06/2003 17:39:13
 
 
À
08/06/2003 15:50:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00797802
Message ID:
00797830
Vues:
27
>>>>I'm using VFP 7.0
>>>>
>>>>In one of my classes, I want to skip the parent.method() code, but still get the parent.parent.method() code.
>>>>
>>>>I remember something about the :: operator, but cannot find anything in the help file that helps.
>>>>
>>>>TIA
>>>
>>>It is called the "scope resolution operator", but I can't find it in the help right now, either.
>>>
>>>In most cases, in VFP 5 or later, it can be replaced with DoDefault(), but you can still use it, for instance, for the case you mention.
>>>
>>>I think a complete example would be like this:
>>>
>>>
>>>lnReturnValue = GrandParent::MyClass(Par1, Par2)
>>>
>>>
>>>Of course, you might omit the return value or the parameters or both, depending on your specific needs.
>>>
>>>HTH,
>>>
>>>Hilmar.
>>
>>Hi Hilmar,
>>
>>>lnReturnValue = GrandParent::MyClass(Par1, Par2)
>>I'm presuming that I would replace "GrandParent" with the actual name of my grandparent class.
>>
>>Do you know if there is some generic way to get at that name?
>>I would like to allow for the possibility of inserting a class in between the current parent class and current grandparent class (redefine parent to ??, making the grandparent a greatgrandparent). I would still want to inherit from the new grandparent.
>>
>>Bill
>
>How about...
>
>This.Parent.ParentClass ?
>
>BOb

Nice try Bob,
I thought of that myself, but .Parent returns the Object.Parent not the class parent.
ie: button.Parent returns the form that the button is located on, not the button's class heirarchy.

I keep making the same mistake all the time. IMHO: Using the work "Parent" to refer to the Object.Parent and also the class parent was a mistake on MS's part.

Looks like Hilmar is on the right track with aClass().
Bill Morris
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform