Example #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();
        }
Example #2
0
 public void setPrototype(Ad ad)
 {
     this.ad = ad;
 }
Example #3
0
 public AdFactory(Ad ad)
 {
     setPrototype(ad);
 }
Example #4
0
        public Object copy()
        {
            Ad copy = new Ad(name, timeLong);

            return(copy);
        }