<p>i've created an abstract base class to store object representations for the ui.</p>
<p>each object consists of any number of elements of which there are three classes of.</p>
<p>so I have created three ui element classes derived from the common abstract class.</p>
<p>however the three classes don't have so much in common when it comes to methods, return types, arguments, data, to make virtual methods seem quite the right way to go.</p>
<p>so I store the element type in the base class and do a switch on that and then perform a static_cast to obtain the correct object type to access its methods. but i'm not really convinced about this either.</p>
<p>I could go with the virtual methods and they could return error codes when called on the wrong ui element type.</p>
<p>just wondering if anyone knows the name of the design pattern that solves this one so I can go read up on it?</p>