inheritance & interface.

alanchinese

Regular
Joined
Jan 12, 2005
Messages
62
is there a way for me to do the following easier? (probably using interface)

i have a baseForm that have 5 different display options(tabpage, list of panels, etc), and varies derivedForms inherited from this baseForm. i handle the display oftions by switch-case, implementing the display functionarities in the baseForm.

now i want to have one baseForm that doesn't need to worry about the display funcionaries. instead, it will have 5 derived Forms called DisplayTypeAForm, DisplayTypeBForm, ... etc.

how should i set up the "third level" Forms (the forms originally derived from the base class) without inheriting each of the 5 DisplayTypeFroms?
 
What I do is to create a designer class that implements an Interface.

This class its the resposable for the layout, and the interface declares the methods needed to make the designer do its job.

The baseClass have a property that instanciates a Designer class.

As all designer classes implement the same interface, you can switch between designers and simply call a, for example, Refresh method of the designer and the appearance is changed...

Alex :p
 
Back
Top