Implement a class with mixins
Frank Benoit
keinfarbton at nospam.xyz
Sat May 6 09:02:02 PDT 2006
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.
.template Foo(){
. this( int a ){}
.}
.
.template Bar(){
. this(){}
.}
.
.class C{
. mixin Foo foo;
. public this(){
. foo.this( 2 ); // if missing => compile error
. // bar.this() is implicit called, manually call is possible
. }
.}
More information about the Digitalmars-d
mailing list