Exemplo n.º 1
0
 private static void Main(string[] args)
 {
     Print(createCliente);
     Print(createCliente);
     Print(CreateClienteRihappy.Singleton());
     Print(CreateClienteRihappy.Singleton());
     Print(CreateClienteRihappy.Singleton());
     Console.WriteLine("Hello World!");
 }
        public static AbstractFactoryClient Singleton()
        {
            if (singletonVar != null)
            {
                Console.WriteLine(singletonVar.GetHashCode());
            }

            return(singletonVar = singletonVar ?? new CreateClienteRihappy());
        }