Beispiel #1
0
 public static BMW createBMW()
 {
     if (bmw == null)
     {
         bmw = new BMW();
     }
     return(bmw);
 }
Beispiel #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();
        }