예제 #1
0
        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();
        }
예제 #2
0
 public Ad makeCopy()
 {
     return((Ad)ad.copy());
 }