public Adapter(FastDigger d) { digger = d; }
static void Main(string[] args) { Digger digger = new Digger(); digger.ToDig(12, 21); FastDigger Dig = new FastDigger(); IDigger digAd = new Adapter(Dig); digAd.ToDig(14, 3); Console.WriteLine(); IFlower flower = new Flower("Flover 1", "red") { height = 4 }; flower.ToGrow(); Console.WriteLine(); IFlower bigflower = new FullFlower(flower); bigflower.ToGrow(); Console.WriteLine(); Console.WriteLine(); var head = new Body { Title = "Head" }; head.AddComponent(new BodyComponent { Title = "Eye" }); head.AddComponent(new BodyComponent { Title = "Skull" }); var body = new Body { Title = "Body" }; body.AddComponent(new BodyComponent { Title = "Leg" }); body.AddComponent(new BodyComponent { Title = "Arm" }); body.AddComponent(new BodyComponent { Title = "Liver" }); body.AddComponent(new BodyComponent { Title = "Heart" }); var human = new Body { Title = "Human" }; human.AddComponent(body); human.AddComponent(head); human.FindComp(); var part = human.Find("Arm"); part.FindComp(); Console.ReadKey(); }