you are a little confused. you don't mark a class as singleton, you
implement a class that follows the pattern.the singleton pattern is when a
instance of a class is created/requested, the same instance is always
returned.
static methods are owned by the class and will not have access to instance
members. they can be called without creating an instance of the (singleton)
class.
instance methods belong to the instance, can access instanse mebersm, and
can only be called from an instance reference.
note: a common singleton practice is to have static methods that create an
instance, then call the instance methods.
-- bruce (sqlwork.com)
"Diffident" <Di*******@disc ussions.microso ft.com> wrote in message
news:7D******** *************** ***********@mic rosoft.com...
My question is if a class is marked as singleton how will the instance
methods in that class work?
Is it a good practice to have instance methods inside a singleton class?
Whats the use of having singleton class with instance methods if you are
going to have only one instance of the class?
Did I make sense?
Thank you.
"KJ" wrote:
If you mark the methods public static, than anyone can call them
without an instance, and then what good is the Singleton pattern? Am I
missing something here?