static void Main(string[] args) { IDrawable picture = new ComplexShape("picture"); IDrawable sky = new ComplexShape("Sky"); IDrawable cloud = new ComplexShape("Cloud"); IDrawable circle = new Circle(); cloud.AddChild(circle); cloud.AddChild(circle); cloud.AddChild(circle); IDrawable cloud2 = new ComplexShape("Cloud"); cloud2.AddChild(circle); cloud2.AddChild(circle); cloud2.AddChild(circle); sky.AddChild(cloud); sky.AddChild(cloud2); IDrawable ground = new ComplexShape("Ground"); ground.AddChild(new SimpleShape("Line")); picture.AddChild(sky); picture.AddChild(ground); picture.Draw(0); }
static void Main(string[] args) { ComplexShape shape1 = new ComplexShape("Complex Shape #1"); Line line1 = new Line("Blue Line #1"); Line line2 = new Line("Blue Line #2"); shape1.AddShape(line1); shape1.AddShape(line2); ComplexShape shape2 = new ComplexShape("Complex Shape #2"); Circle circle1 = new Circle("Yellow Circle #1"); shape2.AddShape(circle1); shape1.AddShape(shape2); shape1.Render(1); }