public static void Main() { for (int i = 0; i < 20; ++i) { Circle circle = (Circle)ShapeFactory.getCircle(getRandomColor()); circle.setX(getRandomX()); circle.setY(getRandomY()); circle.setRadius(100); circle.draw(); } }
static void Main(string[] args) { for (int i = 0; i < 20; i++) { Circle circle = (Circle)FlyweightShapeFactory.GetCircle(getRandomColor()); circle.setX(getRandomCoordinate()); circle.setY(getRandomCoordinate()); circle.setRadius(30); circle.Draw(); } }
static void FlyweightTest() { for (int i = 0; i < 20; ++i) { Flyweight.Circle circle = (Flyweight.Circle)ShapeFactory.GetCircle(getRandomColor()); circle.X = getRandomX(); circle.Y = getRandomY(); circle.setRadius(100); circle.Drow(); } }
static void Main(string[] args) { for (int i = 0; i < 20; ++i) { Circle circle = (Circle)ShapeFactory.getCircle(getRandomColor()); circle.setRadius(100); circle.setX(getRandomX()); circle.setY(getRandomY()); circle.draw(); } Console.Read(); }