Making D Lang More easy.

Matthew Ong ongbp at yahoo.com
Thu May 12 04:08:24 PDT 2011


Hi Walter/Mafi/anyone,

There are modules in D meaning that every file corresponds to exactly
one module which builds a namespace.
When you import you just make symbols of other modules visible. They are not
compiled in. Have to link with the module to make them available.

Using the sample code that mafi provided, how to break them into different file like:

I.d , C.d and import both C & I within D.d file from entirely different module/or
same module namespace?

See the code:
> I need class D to be solid class doing both inherits from C but
> allow me to provide code and for interface I.
import std.stdio;

class C {
     void print() { writeln("print");}
}
interface I { void print(); void  print2();}
class D : C, I {
     void print() { super.print(); }
     void print2() { writeln("print2"); }
}

void main() {
     auto d = new D;
     d.print();
     d.print2();
}


More information about the Digitalmars-d mailing list