public static void Main() { ShapeCache shapeCache = new ShapeCache(); Triangle t = shapeCache.GetTriangleInstance(); t.SetId(1); Triangle t2 = shapeCache.GetTriangleInstance(); t2.SetId(3); t.Draw(); Console.WriteLine(t.GetId()); t2.Draw(); Console.WriteLine(t2.GetId()); //Console.WriteLine(t.GetId()); }