By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,170 Members | 1,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,170 IT Pros & Developers. It's quick & easy.

attribute bag class

P: n/a
looking for some advice on design here - i can do what i want using
casts but it feels wrong and it seems like there must be a better way.

i have some 'things' that need to be rendered to the display but the
way that happens will probably vary over time and each 'thing'
requires a different parameter - say colour for instance.

so, i have a renderer class derrived from an abstract renderer class
with a single pure virtual method called render ()

i also have a rendererAttr class derrived from a base rendererAttr
class with no pure virtual methods since there isn't anything that
will obviously be shared - e.g. this default might use colors but
another implementation might use bitmaps or something.

when creating and processing the 'things', i pass around pointers to
my base renderer and rendererAttr but eventually i need to downcast to
my rendererAttr implementation so i can call non-virtual methods on

i don't know if this is clear without code - i guess what i'm wanting
is pattern that descibes how you create an "action" class and an
"attribute" class and make the two work together without the nasty

any comments?
Jul 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.