public void CreateShape() { DirectX theDirectX = new DirectX(); // 加入形狀 ShapeContainer theShapeContainer = new ShapeContainer(); theShapeContainer.AddShape( new Cube(theDirectX) ); theShapeContainer.AddShape( new Cylinder(theDirectX) ); theShapeContainer.AddShape( new Sphere(theDirectX) ); }