structs, classes, interfaces - Part III, Solution

Daniel Keep daniel.keep.lists at gmail.com
Sat Sep 1 07:39:39 PDT 2007



Jari-Matti Mäkelä wrote:
> ...
> 
> interface IA { void foo(); }
> interface IB { int bar(); }
> 
> struct A : IA { void foo() { writefln("hello"); }
> struct B : IB { int bar() { return 42; } }
> 
> struct C : IA, IB {
>   mixin A;
>   mixin B;
> }

I believe this will be possible using:

struct C : IA, IB {
  private A a;
  private B b;
  alias a this;
  alias b this;
}

	-- Daniel



More information about the Digitalmars-d mailing list