예제 #1
0
파일: BMW.cs 프로젝트: nthuhuong/CodingTest
 public static BMW createBMW()
 {
     if (bmw == null)
     {
         bmw = new BMW();
     }
     return(bmw);
 }
예제 #2
0
        static void Main(string[] args)
        {
            Toyota t       = Toyota.createToyota();
            BMW    b       = BMW.createBMW();
            Thread thread1 = new Thread(t.run); //Put the Toyota in thread and start run
            Thread thread2 = new Thread(b.run); //Put the BMW in thread and start run

            thread1.Start();                    //Start thread1
            thread2.Start();                    //Start thread2
        }