Single "alias this"

Tomek Sowiński just at ask.me
Sun Jul 25 03:43:36 PDT 2010


Deokjae Lee wrote:

> 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? What's the difference between Java's
> approach and single "alias this"?

Huh? This compiles:

class Foo : Base, I1, I2{ }
class Base {}
interface I1 {}
interface I2 {}

As for alias this, it's not about dynamic polymorphism like class 
inheritance. All it does is forward unresolved method calls to the alias 
this'ed member.


Tomek


More information about the Digitalmars-d-learn mailing list