コード例 #1
0
        static void Main(string[] args)
        {
            AbstractWeapon weapon = null;
            AbstractBullet bullet = null;

            weapon = new ConcreteWeapon();
            bullet = weapon.CreateBullet();

            weapon.AnOperation();

            Console.WriteLine("Set the caliber of the bullet: 25");
            bullet.SetCaliber(25);

            Console.WriteLine("Go to the screen calibr: {0} ", bullet.GetCaliber());
            Console.WriteLine(weapon.SomeOperation());
            Console.WriteLine(bullet.Operation());

            Console.ReadKey();
        }
コード例 #2
0
 public void AnOperation()
 {
     bullet = CreateBullet();
     bullet.SetCaliber(this.GetCaliber());
 }