|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
digitalmars.D - The "implemented with" relation
A "implemented with" relation in C++ is done with a private inheritance.
This is OK, because in C++ the public inheritance is not restricted with
this private inheritance (muliple inheritance).
But does a protected inheritance even make sense in a language without
multiple inheritance?
If I do this
class T : private D {
}
the functionality from Object is no more visible to a user of T (if they
are outside of the current module).
e.g. container can complain, they cannot access opEqual. Is this the
wanted behaviour? I don't think so.
To use a "implemented with" relation, one should better use mixins. But
there is a ctor/dtor integration missing. A mixin should be able to have
a this()/~this(), which are implicit called with the outer objects
ctor/dtor. A explicit call of the mixins ctor is also possible. A mixin
can also have a ctor with args: this( int ), which then has to be called
explicitly from the objects ctor, or a compiler error is given.
Please remove the inheritance protection and add the ctor/dtor
integration for mixins.
Sep 29 2006
|