user1256827
user1256827

Reputation: 63

Singleton, Method & Variable

i would like just to get answer to this question, i know it is possible with variables, but with method ?

with a singleton, can i use methods + variables anywhere in my project ?

Thanks.

Upvotes: 0

Views: 64

Answers (2)

bluehallu
bluehallu

Reputation: 10275

A singleton is nothing but a global instance of a class. Once you get the instance anywhere on your project, you're supposed to do whatever you want with it, as you would with any other class instance. Obviously, you can access it's public variables and methods.

Upvotes: 1

zahreelay
zahreelay

Reputation: 1742

Yes, you won't have to create an instance to access your singleton method.

Upvotes: 0

Related Questions