Static Class Items

Monkey Forums/Monkey Programming/Static Class Items

Raz(Posted 2011) [#1]
Please correct me if I have made an incorrect assumption.

A class function is static. A class method relates to the instance of an object.

Can I have static variables? I would like to store the list of an item type within the relative class.

Thanks
-Chris :)


ziggy(Posted 2011) [#2]
Static variables are globals inside a class, if I'm not wrong. Those variables are "shared" across all class instances and derived classes.


therevills(Posted 2011) [#3]
Class Test
  Global list:List = New List<Test>
  
  Function Hello:Void()
    Print "HELLO"
  End
End Class

Test.list
Test.Hello()


:)


Raz(Posted 2011) [#4]
Ahh got ya, so like...



Sorry therevills, didn't see your reply :)