Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Is is possible to create a static class that does not need to be initialized?

Author
Message
Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 22nd Nov 2011 02:26 Edited at: 22nd Nov 2011 02:27
As of right now in DarkGDK I am using a single tier of functions.

Quote: "
Main
DoStuff
DoMoreStuff
DoThings
"


But I could have sworn that we could make STATIC classes (ones that do not have to be created and are just for organization purposes.

Quote: "
Main
Static Class Stuff
-DoStuff
-DoThings
"


So that we could just call:
Stuff.DoStuff;

Rather than having to initialize to a variable name.
Stuff TheDoMachine;
TheDoMachine.DoStuff;

Am I just crazy or is this possible?

Ventures of the worlds around us are limited only by our imagination.
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 22nd Nov 2011 04:42 Edited at: 23rd Nov 2011 01:52
Yes, they're called static methods. Unfortunately, you can't make it an entire static class per se(like in C#), but you can make a class that consists entirely of static methods.

Fairly good explanation and debate about it here:StackOverflow

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 22nd Nov 2011 20:45
You could use a namespace or you could make the constructor private so that you can't instantiate it.

Login to post a reply

Server time is: 2024-03-28 12:32:26
Your offset time is: 2024-03-28 12:32:26