-
Notifications
You must be signed in to change notification settings - Fork 5
/
Student.cs
71 lines (63 loc) · 1.43 KB
/
Student.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
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Linq;
namespace Homework11
{
public delegate void MyDel(int m);
class Accountancy : Student
{
public void PayingFellowship(int mark)
{
marks.Add(mark);
if (marks.Average() < 71)
{
Console.WriteLine("Can't resive");
}
else
{
Console.WriteLine("Congratulation");
}
}
}
class Parent : Student
{
public void ResiveMessage(int mark)
{
Console.WriteLine($"Your sun get new mark {mark}");
}
}
class Student
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
public List<int> marks =new List<int>();
private MyDel markChange;
public event MyDel MarkChange
{
add
{
if (value!=null)
{
markChange += value;
Console.WriteLine();
}
}
remove
{
markChange -= value;
}
}
public void AddMark(int x)
{
marks.Add(x);
if (markChange != null)
markChange.Invoke(x);
}
}
}