www.digitalmars.com         C & C++   DMDScript  

D - Interface delegation to member

reply Sark7 <sark7 mail333.com> writes:
i.e.

interface IFoo
{
   void foo();
}

class Foo : IFoo
{
   void foo() { }
}

class Bar : IFoo
{
   Foo foo implements(?) IFoo;
}

and any call to bar.foo() will be redirected to foo.foo()

Delphi have this feature, and I think it be good to have this feature in D.
Mar 03 2004
parent C. Sauls <C._member pathlink.com> writes:
Or in other words, an object can trust another object to provide its interface
implementation.  Not a bad idea, really.  This should be taken care of once we
have mixins, though:

interface IFoo {
void foo();
}

class StdFoo : IFoo {
void foo() { ... }
}

class Bar : IFoo,mixin StdFoo {
//automatic
}

-C. Sauls
-invironz

In article <opr4a891n6ut8jae news.digitalmars.com>, Sark7 says...
i.e.

interface IFoo
{
   void foo();
}

class Foo : IFoo
{
   void foo() { }
}

class Bar : IFoo
{
   Foo foo implements(?) IFoo;
}

and any call to bar.foo() will be redirected to foo.foo()

Delphi have this feature, and I think it be good to have this feature in D.
Mar 03 2004