Implement a class with mixins
Sean Kelly
sean at f4.ca
Sun May 7 11:45:18 PDT 2006
Frank Benoit wrote:
> Does a protected inheritance make sense in a language without multiple
> inheritance? Inherit private is for a "implemented with" relation. And
> this is perhaps better made with the mixin feature.
>
> But to use mixins like base classes for implementation, mixins are
> missing a Ctor ( and DTor ) integration. It should be possible for a
> mixin to have a Ctor which is automatically called while the object is
> contructed. Or it can be called manually ( with args ) from the class ctor.
It would be great if there were an easy way to make this work. As it
is, I have to know in advance something is intended to be a mixin and
create separate methods for this. For a somewhat more complicated
example, I use the technique here:
http://www.home.f4.ca/sean/d/stream.d
Sean
More information about the Digitalmars-d
mailing list