single class in file

Jan Hanselaer jan.hanselaer at gmail.com
Sat May 5 13:11:03 PDT 2007


Hi

I'm trying to make a class in a module. A bit inspired by java where one 
class is one object.
Altough I tought this would work in D too.
The code here works. But I just want the class Test in that file. And then I 
want to use it in my main program (in another file).
I don't need a main in this module, but without it I can't compile the file. 
Whu is this? And what's the right way to do it?
I can't just put all my code in one file. Well I could ... but I don't want 
to.

file :  test.d

class Test
{
      char[] name;
      int nr;

      this()
      {
         name = "test";
         nr = 1;
      }
}

void main(){} 




More information about the Digitalmars-d-learn mailing list