Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Class inheritance versus Object (run-time) inheritance
Message
De
07/07/1999 22:03:48
 
 
À
07/07/1999 20:14:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00238626
Message ID:
00238649
Vues:
21
>I'm just learning to grok this stuff, so please be patient.
>
>It strikes me that it can be useful for objects to inherit PEM attributes from their class hierarchy or from the object hierarchy in which they execute at run-time. For example, the default Error Event could be inherited from the class-hierarchy upon which an object is based, or could, for example, be 'inherited' from the form object from which it was invoked at run time.
>
>In a way, THISFORM and THIS are a means by which the abstract class hierarchy can tell its descendents to reference the attributes of their respective runtime parent objects. But of course, you still must have enough forsight at class definition time to enable run-time objects to (by default) inherit behavioral requirements from the container objects that contain them.
>
>(This question seems strikingly similar to the old nature vs. nurture debate! ... hmm?... Object Oriented Existentialism?? ;-) )
>
>Does classical OOP thinking address this distinction and are 'THISFORM' and 'THIS' VFP's primary means of addressing the issue, or am I just an Old Procedural Programming Dinosaur (OPPD for you AN's...acronym nuts) who's still having trouble seeing beyond the bounds of his native worldview?

I'm not sure if there's a pattern name for this, but I use it a lot. For instance, many of my controls have the ability to save their state to the user's registry. To do this, they must know where in the registry t store their settings. In addition to a RetgistryName property, all base controls use the containing form's RegistryApp property which is a registry location. The form's registryApp property can be set at design time, but if it has none, uses the REgistryApp property of the global app object.

To see an example of a set of classes that takes this "container" inheritance to te extreme, take a look at Doug Hennig's article and files on error handling (www.stonefield.com). Each of the base classes in his framework know how to traverse first up the class hierarchy, and then up the containership hierarchy looking for an error handler, resorting to ON ERROR only after exhausting all other avenues.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform