public void AddFlowerToFlowerCollection(string className, int count, string flowername) { Flower fl; for (int i = 0; i < count; i++) { switch (className) { case "Astra": fl = new Astra(flowername); break; case "Tulip": fl = new Tulip(flowername); break; case "Violet": fl = new Violet(flowername); break; default: throw new Exception("Flower type not found."); } this.FlowerCollection.Add(fl); } }
static void Main(string[] args) { var Bobby = new Rose(); var Dandy = new Dandelion(); var Sunny = new Sunflower(); var Vi = new Violet(); FlowerShop MacsFlowerShop = new FlowerShop(); List <IBirthDay> Arrangement = MacsFlowerShop.MakeBirthDayArrangement(); }