1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
6
namespace 泡妞的故事
7
{
8
class Program
9
{
10
static void Main(string[] args)
11
{
12
Agreement ag = new Agreement();
13
Console.WriteLine("纪晓岚:老夫人,我们去读书了!");
14
Console.WriteLine("老夫人:乖,好好读呀!");
15
ag.Reading();
16
Console.WriteLine("纪晓岚:老夫人,我们去练字了!");
17
Console.WriteLine("老夫人:好呀好呀!");
18
ag.Writing();
19
}
20
}
21
class Girl
22
{
23
public void Eating()
24
{
25
Console.WriteLine("和姑娘吃东西啊");
26
Console.ReadLine();
27
}
28
public void Shopping()
29
{
30
Console.WriteLine("和姑娘吃购物啊");
31
Console.ReadLine();
32
}
33
public void Travelling()
34
{
35
Console.WriteLine("和姑娘吃游山玩水啊");
36
Console.ReadLine();
37
}
38
}
39
public interface Mother
40
{
41
void Reading();
42
void Writing();
43
}
44
public class Agreement : Mother
45
{
46
Girl girl = new Girl();
47
public void Reading()
48
{
49
girl.Eating();
50
girl.Shopping();
51
}
52
public void Writing()
53
{
54
girl.Travelling();
55
}
56
}
57
58
}
59
不过最后我还是有一个问题 接口是用来做什么的呢 在这里 他并没有限制Agreement 类的行为啊,期待高手解答啊
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
