Recommended ways to handle final classes
Dicebot
public at dicebot.lv
Fri Aug 16 10:08:33 PDT 2013
On Friday, 16 August 2013 at 16:27:37 UTC, Joseph Rushton
Wakeling wrote:
> On 08/16/2013 06:12 PM, Dicebot wrote:
>> Maybe we can come with a better proposal if you explain what
>> object model are
>> you trying to achieve?
>
> The idea is maybe more to be able to have,
>
> _A -- base class
> A : _A -- final class that doesn't change _A's functionality
> B : _A -- final class that _does_ override _A's functions
That makes some sense indeed, all you need is to stop naming base
class "_A" and give it a proper meaningful name that reflects its
role in object model :)
From the conceptual purity point of view I still think that
having bunch of template mixins instead of _A and just combining
them into A or B is the proper way (inheritance should not be
used as code reusage tool) - but D may not have powerful enough
tools to makes this approach convenient, so resorting to
old-school inheritance sounds pragmatical.
You need to be aware though that I am personally an OOP hater and
my advices should be reconsidered in with that in mind ;)
More information about the Digitalmars-d-learn
mailing list