-
Notifications
You must be signed in to change notification settings - Fork 0
/
Philosopher.cs
58 lines (48 loc) · 1.2 KB
/
Philosopher.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
55
56
57
58
namespace ConsoleOOPApp;
public abstract class Philosopher : IPhilosophicalThinking
{
#region Properties and fields of the class.
/// <summary>
/// Name.
/// </summary>
public string Name
{
get => _name;
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentNullException(nameof(value), "The name cannot be empty!");
}
_name = value;
}
}
/// <summary>
/// Name.
/// </summary>
private string _name;
/// <summary>
/// Initialization of class properties.
/// </summary>
/// <param name="name"> Name. </param>
protected Philosopher(string name)
{
Name = name;
}
#endregion
#region Методы.
/// <summary>
/// Belonging to the philosophical school.
/// </summary>
/// <returns> Returns the philosophical school. </returns>
public abstract string PhilosophicalSchool();
/// <summary>
/// Overriding the toString method.
/// </summary>
/// <returns> Returns the name of the philosopher. </returns>
public override string ToString()
{
return $"Name - {Name}";
}
#endregion
}