1 using System;
2
3
4
5
6
7 public abstract class UpperLayerComponentBase
8 {
9 public abstract void SomeMember();
10 }
11
12
13
14 public class UpperLayerComponent : UpperLayerComponentBase, UpperLayerInterface
15 {
16
17 public UpperLayerComponent() : lower(*this)
18 {
19 }
20 public override void SomeMember()
21 {
22 lower.ServiceForUpper();
23
24 }
25 public void ServiceForLower()
26 {
27
28 }
29 private LowerLayerComponent lower;
30 }
31
32
33
34
35
36
37
38 public interface UpperLayerInterface
39 {
40 void ServiceForLower();
41 }
42
43
44
45 public class LowerLayerComponent
46 {
47 public LowerLayerComponent(UpperLayerInterface upper_) : upper(upper_)
48 {
49 }
50 public void ServiceForUpper()
51 {
52
53 }
54 public void AnotherMember()
55 {
56
57 upper.ServiceForLower();
58
59 }
60 private UpperLayerInterface upper;
61 }