Is there a way of avoiding writing two separate functions for the above? In other words is it possible to re-direct the output from Serial to client without adding more code for the same functionality?
First of all...how does PrintIPAddress know to print through serial or client?
For now PrintIPAddress only prints through Serial. I am looking at ways to make it also print through client without writing an entirely separate function. The same applies for other functions as well. The above is only an example.
The only way I can think of doing that would be to make a function with a type of parameter, but the object types would need to be the same, but they are not...so you would need a new class, but from here it gets completely pointless...so I got nothing...
I was also thinking that maybe I could pass a parameter to a function which would somehow determine where the output goes. But then couldn't figure out how to actually do it from there.
You guys are over-complicating this. Both HardwareSerial and EthernetClient extend the Print class, which has the print and println methods. Just make your functions take a reference to an instance of the Print class.