Single "alias this"
Simen kjaeraas
simen.kjaras at gmail.com
Sun Jul 25 05:04:40 PDT 2010
Deokjae Lee <asitdepends at gmail.com> wrote:
> Is there any particular reason to disallow multiple "alias this" ?
Yes - the fact that it's not yet implemented. (it's on the drawing board
, just not quite there yet.)
> I can implement "multiple" interfaces and extend "single" base class in
> Java like this:
>
> <code>
> class C extends BaseClass implements Interface1, Interface2, ...
> </code>
>
> But I can't do it using D. Code like the following does not be compiled.
>
> <code>
> class C : BaseClass, Interface1, Interface2, ...
> </code>
>
> Is there any particular reason?
Uhm... That's supposed to work.
> What's the difference between Java's approach and single "alias this"?
Java's (and D's) interfaces is something quite different from alias
this. Alias this is a simplistic (though powerful) kind of subtyping
where the class or struct can embed a different type, and behave as if
it is one, though without polymorphism.
--
Simen
More information about the Digitalmars-d-learn
mailing list