static void Main(string[] args) { Ad original = new Ad("Jacobs", 30); Console.WriteLine(original.toString()); Ad copy = (Ad)original.copy(); Console.WriteLine(copy.toString()); AdFactory factory = new AdFactory(copy); Ad a1 = factory.makeCopy(); Console.WriteLine(a1.toString()); factory.setPrototype(new Ad("Nescafe", 180)); Ad a2 = factory.makeCopy(); Console.WriteLine(a2.toString()); Console.ReadKey(); }
public Ad makeCopy() { return((Ad)ad.copy()); }