-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObserverRepaet.cs
54 lines (42 loc) · 903 Bytes
/
ObserverRepaet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Singleton
{
internal class ObserverRepaet
{
}
public interface IGamer
{
void StopPlaying();
}
public class Gamer : IGamer
{
public string Name { get; set; }
public Gamer(string name)
{
Name = name;
}
public void StopPlaying()
{
Console.WriteLine($"Player are stopping to play {Name}");
}
}
public class GameMaster1
{
List<IGamer> gamers = new List<IGamer>();
public void Addgamer(Gamer gamer)
{
gamers.Add(gamer);
}
public void stopPlaying()
{
foreach (var gamer in gamers)
{
gamer.StopPlaying();
}
}
}
}