Skip to content

Commit 04f3e58

Browse files
committed
Creational Pattern -- Singleton Pattern
1 parent 1c7e4ae commit 04f3e58

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/coordinates.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ class Coordinates:
55
"""
66
A position on earth using decimal coordinates (latitude and longitude).
77
"""
8+
__instance = None
89

10+
@staticmethod
11+
def getInstance():
12+
if Coordinates.__instance == None:
13+
Coordinates
14+
return __instance
15+
916
def __init__(self, latitude, longitude):
1017
self.latitude = latitude
1118
self.longitude = longitude

0 commit comments

Comments
 (0)