H. S. Teoh wrote:

On Fri, May 11, 2018 at 05:28:48PM -0600, Jonathan M Davis via Digitalmars-d wrote:
[...] what the OP wants is to have the class be publicly available
while restricting who's allowed to derive from it, with the idea that
a particular class hierarchy would have a well-defined set of classes
that the person who wrote them had full control over rather than
allowing anyone and everyone to derive from any class in the hierarchy
except for any final classes at the leaves of the hierarchy.
[...]

I would like to hear of a real-world use case for such a restriction. I
honestly can't think of one that doesn't have a design smell of some
sort.  Isn't the whole point of OOP that user code can extend your
classes to implement functionality you have not thought of, rather than
you needing to implement everything for them?


T

besides, in D, there is a little sense in restricting class anyway, as we can kinda "extend" it with UFCS at any time.

Reply via email to