<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 10/14/2013 12:22 PM, James Morris
wrote:<br>
</div>
<blockquote
cite="mid:CAPLoHyp8TrypLGdOBy+qfM+XQ0Dxs-ON1eMk70_wGD=uRJm04Q@mail.gmail.com"
type="cite">
<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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kent mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kent@mailman.lug.org.uk">Kent@mailman.lug.org.uk</a>
<a class="moz-txt-link-freetext" href="https://mailman.lug.org.uk/mailman/listinfo/kent">https://mailman.lug.org.uk/mailman/listinfo/kent</a></pre>
</blockquote>
you could use three decorator classes which are instantiated via a
factory when given an object instance?<br>
</body>
</html>