Advertisement
uurha

Untitled

Jun 8th, 2022 (edited)
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. public interface IMoneyGiver
  2.     {
  3.         void GiveMoney();
  4.     }
  5.  
  6.     public interface IDamageDealer
  7.     {
  8.         void DealDamage();
  9.     }
  10.  
  11.     public interface IEntity : IMoneyGiver, IDamageDealer
  12.     {
  13.        
  14.     }
  15.    
  16.     public class Entity : IEntity
  17.     {
  18.         private IMoneyGiver _moneyGiver = new DefaultMoneyGiver();
  19.         private IDamageDealer _damageDealer = new DefaultDamageDealer();
  20.        
  21.         public void GiveMoney()
  22.         {
  23.             _moneyGiver.GiveMoney();
  24.         }
  25.  
  26.         public void DealDamage()
  27.         {
  28.             _damageDealer.DealDamage();
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement