static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1971); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); Rover[] rov = new Rover[] { lunokhod, apollo, sojourner }; DirectAll(rov); Object[] all = new Object[] { lunokhod, apollo, sojourner, sputnik }; foreach (Object al in all) { Console.WriteLine($"Tracking a {al.GetType()}…"); } IDirectable[] dict = new IDirectable[] { lunokhod, apollo, sojourner, sputnik }; }
static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1971); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); Rover[] rovers = new Rover[] { lunokhod, apollo, sojourner }; DirectAll(rovers); Object[] allSpaceObjects = new Object[] { lunokhod, apollo, sojourner, sputnik }; foreach (Object spaceObject in allSpaceObjects) { Type t = spaceObject.GetType(); Console.WriteLine($"Tracking a {t}..."); } IDirectable[] spaceObjects = new IDirectable[] { lunokhod, apollo, sojourner, sputnik }; Console.WriteLine(" "); DirectAll(spaceObjects); Console.ReadLine(); }
static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1971); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); Rover[] theRovers = new Rover[] { lunokhod, apollo, sojourner }; Object o1 = lunokhod; Object o2 = apollo; Object o3 = sojourner; Object o4 = sputnik; Object[] objects = new Object[] { o1, o2, o3, o4 }; foreach (Object o in objects) { Console.WriteLine($"Tracking a {o.GetType()}..."); } IDirectable[] theDirectables = new IDirectable[] { lunokhod, apollo, sojourner, sputnik }; DirectAll(theDirectables); }
static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1971); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); //Rover[] rovers = {lunokhod, apollo, sojourner}; //Object[] probes = {lunokhod, apollo, sojourner, sputnik}; IDirectable[] probes = { lunokhod, apollo, sojourner, sputnik }; DirectAll(probes); }
static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1971); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); // Object[] objects = new Object[4]{lunokhod, apollo, sojourner, sputnik}; // DirectAll(objects); IDirectable[] probes = new IDirectable[4] { lunokhod, apollo, sojourner, sputnik }; DirectAll(probes); Console.ReadLine(); }
static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1971); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); Rover[] arr1 = { lunokhod, apollo, sojourner }; DirectAll(arr1); Object[] arr2 = { lunokhod, apollo, sojourner, sputnik }; foreach (Object j in arr2) { Console.WriteLine($"Tracking a {j}"); } IDirectable[] arr3 = { lunokhod, apollo, sojourner, sputnik }; }
static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1971); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); /*Rover[] rover = {lunokhod, apollo, sojourner}; * DirectAll(rover); * * Object[] probes = { lunokhod, apollo, sojourner, sputnik}; * foreach (Object o in probes) * { * Console.WriteLine($"Tracking a {o.GetType()}"); * }*/ IDirectable[] directables = { lunokhod, apollo, sojourner, sputnik }; DirectAll(directables); }
static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1971); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); //Rover[] rovers = { lunokhod, apollo, sojourner }; //DirectAll(rovers); //Object[] probes = { lunokhod, apollo, sojourner, sputnik }; //Console.WriteLine($"Tracking a {lunokhod.GetType()}..."); //Console.WriteLine($"Tracking a {probes[1]}..."); //Console.WriteLine($"Tracking a {probes[2]}..."); //Console.WriteLine($"Tracking a {probes[3]}..."); IDirectable[] idirectables = { lunokhod, apollo, sojourner, sputnik }; DirectAll(idirectables); }
static void Main(string[] args) { MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970); MoonRover apollo = new MoonRover("Apollo 15", 1975); MarsRover sojourner = new MarsRover("Sojourner", 1997); Satellite sputnik = new Satellite("Sputnik", 1957); Rover[] rovers = new Rover[] { lunokhod, apollo, sojourner }; Object[] probesList = new object[] { lunokhod, apollo, sojourner, sputnik }; IDirectable[] directProbes = new IDirectable[] { lunokhod, apollo, sojourner, sputnik }; foreach (Object item in probesList) { Console.WriteLine($"Tracking a : {item.GetType()}"); } Console.WriteLine("*************************************************\n"); DirectAll(rovers); }