iOS Question Can instances of a class by used globally?

Discussion in 'iOS Questions' started by Derek Johnson, Jun 24, 2015.

  1. Derek Johnson

    Derek Johnson Active Member Licensed User

    I tried doing this:

    Code:
    Main:

    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'Public variables can be accessed from all modules.
        ...
        
    Public pm As clsPreferenceManager
    End Sub
    and then I tried to use this instance in another module

    eg

    Code:
    Sub Something
        pm.GetString(
    "Location")
    End Sub
    but the object was not recognised.

    Is this the expected behaviour - i.e. instances of classes cannot be Public?

    Derek
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You need to access it with:
    Code:
    Main.pm.GetString(...)
     
    Derek Johnson likes this.
  3. Derek Johnson

    Derek Johnson Active Member Licensed User

    Sorry - obvious!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice