www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Entry (main) method inside a class?

reply Dejan Lekic <dejan.lekic gmail.com> writes:
Well, I think it is very good to have main _inside_ a class I am currently
"playing with" during the development process (of the class). Sure I can have a
main() function in the same module and play with the class there, but somehow I
"feel" it belongs to the class block. Obviously this is a matter of taste, so
it does not really matter whether we will have this "feature" in D or not. I
just started this thread because I thought it is somehow possible to do it... :)
Mar 18 2007
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Dejan Lekic wrote:

 Well, I think it is very good to have main _inside_ a class I am
 currently "playing with" during the development process (of the
 class). Sure I can have a main() function in the same module and play
 with the class there, but somehow I "feel" it belongs to the class
 block. Obviously this is a matter of taste, so it does not really
 matter whether we will have this "feature" in D or not. I just started
 this thread because I thought it is somehow possible to do it...  :)

I don't get it. If you like having main in a class so much just put it there and call it. If you like Java, then apparently you like typing and this way you get to do even more of it! :-) class MyClass { public static void main(char[][] args) { writefln("Whee I'm main now!"); } } void main(char[][] args) { MyClass.main(); }
Mar 18 2007