Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Decorator pattern question
Message
From
18/03/1999 09:48:40
Rex Mahel
Realm Software, Llc
Ohio, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Decorator pattern question
Miscellaneous
Thread ID:
00199184
Message ID:
00199184
Views:
44
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
Next
Reply
Map
View

Click here to load this message in the networking platform