static void Main(string[] args) { Sphere[] spheres = new Sphere[10]; spheres[0] = new Sphere("Sphere 1", 10); spheres[1] = new Sphere("Sphere 2", 20); spheres[2] = new Sphere("Sphere 3", 30); spheres[3] = new Sphere("Sphere 4", 40); spheres[4] = new Sphere("Sphere 5", 50); spheres[5] = new Sphere("Sphere 6", 60); spheres[6] = new Sphere("Sphere 7", 70); spheres[7] = new Sphere("Sphere 8", 80); spheres[8] = new Sphere("Sphere 9", 90); spheres[9] = new Sphere("Sphere 10", 100); foreach (Sphere s in spheres){ Console.WriteLine(s + "\n"); } Console.ReadKey(); }
static void Main(string[] args) { IHasVoume[] shapes = new IHasVoume[10]; shapes[0] = new Sphere(10); shapes[1] = new Sphere(20); shapes[2] = new Sphere(30); shapes[3] = new Sphere(40); shapes[4] = new Sphere(50); shapes[5] = new Sphere(60); shapes[6] = new Sphere(70); shapes[7] = new Sphere(80); shapes[8] = new Sphere(90); foreach (Sphere s in shapes) { Console.WriteLine(s + "\n"); } Console.ReadKey(); }
public void Visit(Sphere sphere) { Console.WriteLine("The Sphere thats called " + sphere.Name); }
public virtual void Visit(Sphere sphere) { }