patterns/singleton/template/singleton.cs - A template of a singleton class. | Lecture 4 - slide 25 : 29 Program 1 |
public class Singleton{ // Instance variables private static Singleton uniqueInstance = null; private Singleton(){ // Initialization of instance variables } public static Singleton Instance(){ if (uniqueInstance == null) uniqueInstance = new Singleton(); return uniqueInstance; } // Methods }