Skip to content

Commit 35ac2d2

Browse files
authored
rename instance variable
1 parent fb03481 commit 35ac2d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

singleton/src/singleton.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ namespace Singleton {
22
class Singleton {
33
// A variable which stores the singleton object. Intially,
44
// the variable acts like a placeholder
5-
private static __singleton: Singleton = null;
5+
private static singleton: Singleton = null;
66
// private constructor so that no instance is created
77
private constructor() {
88
}
99
// This is how we create a singleton object
1010
public static getInstance(): Singleton {
1111
// check if an instance of the class is already created
12-
if (this.__singleton == null) {
12+
if (this.singleton == null) {
1313
// If not created create an instance of the class
1414
// store the instance in the variable
15-
this.__singleton = new Singleton();
15+
this.singleton = new Singleton();
1616
}
1717
// return the singleton object
18-
return this.__singleton
18+
return this.singleton
1919
}
2020
}
2121
}

0 commit comments

Comments
 (0)