abstrakcyjny

 abstract class Weapon
    {
        public abstract int Damage { get; }
        public abstract void Fire();
        public void showInfo()
        {
            Console.WriteLine($"{GetType().Name} Damage: {Damage}");
        }
    }
    class Gun : Weapon
    {
        public override int Damage => 3;

        public override void Fire()
        {
            Console.WriteLine("Gun");
        }
    }
    class Bow : Weapon
    {
        public override int Damage { get { return 5; } }
        public override void Fire()
        {
            Console.WriteLine("Bow");
        }
    }
    class Player
    {
        public void f(Weapon w)
        {
            w.Fire();
            w.showInfo();
        }

    }
    class Program
    {
        static void Main(string[] args)
        {
            Player p = new Player();
            Weapon[] inventor = { new Gun(), new Bow() };
            foreach (var item in inventor)
            {
                
                p.f(item);
            }
        }
    }
Info Important