Beispiel #1
0
 def __init__(self):
     self.dataset = Strategy.LoadDataset()
     self.database = Singleton.Singleton()
Beispiel #2
0
from Singleton import *

if __name__ == '__main__':

    singletonObjOne = Singleton.instance()
    print("Memory address of the first obj")
    print(id(singletonObjOne))

    singletonObjOne = Singleton.instance()
    print("Memory address of the second obj")
    print(id(singletonObjOne))

    print("Can I initiate the object")
    singletonObjThree = Singleton()
    print(singletonObjThree)




import Singleton

if __name__ == '__main__':
    print("Start.")
    obj1 = Singleton.Singleton()
    obj2 = Singleton.Singleton()

    if obj1 == obj2:
        print("obj1与obj2是相同的实例")
    else:
        print("obj1与obj2是不同的实例")

    print("End.")


Beispiel #4
0
 def getInstance():
     return Singleton.getInstance(BattleNotify)
 def getInstance():
     return Singleton.getInstance(BaseS2SCaller)
Beispiel #6
0
 def getInstance():
     return Singleton.getInstance(GameGlobalConfig)
 def getInstance():
     return Singleton.getInstance(AntiAddiction)
Beispiel #8
0
 def getInstance():
     return Singleton.getInstance(BaseLogicServer)
Beispiel #9
0
 def getInstance():
     return Singleton.getInstance(DBHelper)