A class which allow users to create object only once not more than 1 time is known as Singleton design pattern.
we can make only one object of the class.
Example-
in the SIB we create the object because SIB executes only once throughout the execution of program.
P class contains the private constructor so except P no other class create the object of P.
for object creation we getObject();
when we called getobject method ,SIB executes one time which creates the object.....
so by using the SIB we implement the singleton design pattern.....
we can make only one object of the class.
Example-
in the SIB we create the object because SIB executes only once throughout the execution of program.
P class contains the private constructor so except P no other class create the object of P.
for object creation we getObject();
when we called getobject method ,SIB executes one time which creates the object.....
so by using the SIB we implement the singleton design pattern.....
No comments :
Post a Comment