Exemplo n.º 1
0
 public static Toyota createToyota()
 {
     if (toyota == null)
     {
         toyota = new Toyota();
     }
     return(toyota);
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Toyota t = Toyota.createToyota();
            BMW    b = BMW.createBMW();

            Console.WriteLine("Call the run() of the Toyota:");
            t.run();
            Console.WriteLine("Call the run() of the BMW:");
            b.run();
        }