static void Main(string[] args) { SingleObject op = SingleObject.getInstance(); op.ShowMethod(); SingleObject op2 = SingleObject.getInstance(); op2.ShowMethod(); Console.ReadLine(); }
public static SingleObject getInstance() { if (instance == null) { instance = new SingleObject(); return(instance); } else { return(instance); } }
private SingleObject() { instance = null; }