single class in file
Bill Baxter
dnewsgroup at billbaxter.com
Sat May 5 13:18:02 PDT 2007
Jan Hanselaer wrote:
> 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(){}
Use 'dmd -c' if you want to compile only with no linking.
Use bud or rebuild if you want to make your life easy.
--bb
More information about the Digitalmars-d-learn
mailing list