模式乱写之2 : 接口VS抽象类 Interface VS Abstract Class
- 接口支持多继承;
- 抽象类支持缺省实现;
- is-a vs can-do ;
1 public interface ITh
2 {
3 void Pose();
4 }
5
6 public interface ITb
7 {
8 void Post();
9 }
10
11 public class QThought : ITb, ITh
12 {
13 public void Pose()
14 {
15 }
16
17 public void Post()
18 {
19 }
20 }
2 {
3 void Pose();
4 }
5
6 public interface ITb
7 {
8 void Post();
9 }
10
11 public class QThought : ITb, ITh
12 {
13 public void Pose()
14 {
15 }
16
17 public void Post()
18 {
19 }
20 }