Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Decorator pattern question
Message
De
18/03/1999 09:48:40
Rex Mahel
Realm Software, Llc
Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Decorator pattern question
Divers
Thread ID:
00199184
Message ID:
00199184
Vues:
45
All,

I want to use a Decorator pattern, but I have a question.

If you chain functionality by using multiple decorators, don't you need a generic way to access that functionality, especially in any decorator not at the "end" of the chain.

For example, I have an object, Object1 and two decorators, Decorator1 & Decorator2. Decorator1 has Function1 and Decorator2 has Function2.

I instantiate a combination object with:

loCombinedObject = CREATEOBJECT("Decorator1",CREATEOBJECT("Decorator2,CREATEOBJECT("Object1")))

I now want to access This.Function2, but it does not exist. Function2 is accessed by This.oRef.Function2. What if I have more than just 2 decorators, I would have to know in what order the decorators were instantiated in order to access the decorator properties. I would need some sort of a generic routine to search the instantiation tree looking for the property/method.

Am I making any sense, or have I overlooked something?

TIA

Rex
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform