Guest User

SRP

a guest
Jan 24th, 2021
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1.     public abstract class Employee : IEmployee
  2.     {
  3.         public Employee(int workExperience, string fullName)
  4.         {
  5.             WorkExperience = workExperience;
  6.             FullName = fullName;
  7.         }
  8.         public int WorkExperience { get; set; }
  9.        
  10.         public string FullName { get; set; }
  11.        
  12.         public abstract void DoWork();
  13.     }
  14.    
  15.  
  16.  
  17.     public class Manager : Employee, IManager
  18.     {
  19.         public Manager(int workExperience, string fullName) : base(workExperience, fullName)
  20.         {
  21.         }
  22.  
  23.         public override void DoWork()
  24.         {
  25.             GetOrders();
  26.         }
  27.  
  28.         private void GetOrders()
  29.         {
  30.             Console.WriteLine("Manager is getting orders");
  31.         }
  32.  
  33.         public void GiveTheTask(string task, IEmployee employee)
  34.         {
  35.             Console.WriteLine($"Manager gives the task: [{task}] to [{employee.FullName}]");
  36.         }
  37.    }
  38.    
  39.  
  40.     public interface IManager
  41.     {
  42.         void GiveTheTask(string task, IEmployee employee);
  43.     }
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment