示例#1
0
        public static fruit getInstance(String fruitName)
        {
            fruit f=null;
            switch(fruitName)
            {
            case "Apple" :
                f=new Apple();
                break;
            case "Orange" :
                f=new Orange();
                break;
            default:
            break;

            }
            return f;
        }
示例#2
0
 public Apple(Apple a)
 {
     Amount = a.Amount;
     ID     = a.ID;
 }