Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp7
- {
- class Program
- {
- static void Main(string[] args)
- {
- Doctor test = new Doctor();
- Doctor doctor1 = new Doctor()
- {
- Name = "John",
- Age = 30,
- Expirience = 4
- };
- Doctor doctor2 = new Doctor()
- {
- Name = "Jack",
- Age = 28,
- Expirience = 7
- };
- test.CanPerformOperation(doctor1, delegate () {
- return doctor1.Expirience > 5 && doctor1.Age < 40;
- });
- test.CanPerformOperation(doctor2, delegate () {
- return doctor2.Expirience > 5 && doctor2.Age < 40;
- });
- Console.ReadLine();
- }
- }
- public delegate bool CanPromotedDelegate();
- //5 diferent ways of calculating for CanPerformOperation
- // 1. Expirience > 5 AND age < 40
- // 2. Expirience > 6 AND age < 45
- // 3. Expirience > 7 AND age < 46
- // 4. Expirience > 8 AND age < 47
- // 5. Expirience > 9 AND age < 48
- public class Doctor
- {
- public int Expirience { get; set; }
- public int Age { get; set; }
- public string Name { get; set; }
- public void CanPerformOperation(Doctor d, CanPromotedDelegate del)
- {
- if (del() == true)
- {
- Console.WriteLine($"{d.Name} can perform operation");
- }
- else
- {
- Console.WriteLine($"{d.Name} cannot perform operation");
- }
- }
- }
- //5 diferent ways of calculating for CanGoUnderOperation
- // 1. age < 40
- // 1. age < 45
- // 1. age < 46
- // 1. age < 47
- // 1. age < 48
- public class Patient
- {
- public int Age { get; set; }
- public bool CanGoUnderOperation()
- {
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement