Entry (main) method inside a class?

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Mar 16 15:26:16 PDT 2007


Dejan Lekic wrote:
> Is there particular reason why we are not able to have entry (main) method inside a class, like is possible in JAVA for an example?
> Even though I am not a big JAVA fan, I must say I like that feature... :)

AFAIK the only reason Java has that "feature" is its complete inability 
to have functions *outside* of classes :).

Though I could see uses for this, like to run unittests (similarly to 
what running Python modules "stand-alone" often does).
D has gone another way there though, using explicit unittest {} blocks. 
Unfortunately, there is currently no way to run these separately (esp. 
right after compilation) that I know of.



More information about the Digitalmars-d mailing list