1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

calling a method

Discussion in 'Development' started by Masternoob, Feb 16, 2012.

  1. Masternoob

    Masternoob Member

    Is there a way that i can make a method available in my whole program?

    i wrote a test class with a method and i want to use it in my programm without having to do this before every call:
    Code (progress):
    1. definine variable xxx as class class.yyy no-undo.
    2. xxx = NEW class.yyy
    thx for your help
  2. KleineCuypie

    KleineCuypie New Member

    You can make a static method. Then you don't have to initiate the class and directly go to your method by using.
    Code (progress):
    1.  
    2. class.yyy:yourMethod().
    3.  
    4.  
    5. CLASS class.yyy:
    6.  
    7.  
    8. METHOD PUBLIC STATIC VOID yourMethod():
    9. END METHOD.
    10.  
  3. Masternoob

    Masternoob Member

    thank you!
  4. tamhas

    tamhas ProgressTalk.com Sponsor

    WARNING! Use statics with care. Once the class is referenced, it is in memory until the session is over. No way to remove it. There are many unpleasant side effects. Only make something static when you are really, really sure that is the right thing to do.

Share This Page