Jump to content

Keeping track of a global variable


Recommended Posts

Posted (edited)
34 minutes ago, LoudPacks said:

You can reference static variables from non-static instances.

it's still the same idea....

void thisIsDumb(){

 if(Main.badDesign){

  ...

 }

}

 

If u wanna share, just use get/set(multiple class). If u wanna make something public static, make sure it's immutable. If it's just within the same class.. public anything will do l0l

btw-- I c what u mean, i don messed up. But uh yea, no point having static if it's within the same class and if not then^

Edited by dreameo
Posted
1 hour ago, dreameo said:

it's still the same idea....

void thisIsDumb(){

 if(Main.badDesign){

  ...

 }

}

 

If u wanna share, just use get/set(multiple class). If u wanna make something public static, make sure it's immutable. If it's just within the same class.. public anything will do l0l

btw-- I c what u mean, i don messed up. But uh yea, no point having static if it's within the same class and if not then^

Yea it really depends on what you're trying to do. No point in using static vars / methods if you don't need to. I was just generalizing.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...