I am writing a simple console application and i want to be able to print to the screen.
public class Car{
public void Drive(){
//Here I want to print that the car is driving
}
}
I could just use Console.Writline() in my Drive() function but I don't think that is a good design because in the future i may want to log that to a file instead. What is the best design to achieve this multi-output logging feature? is there a common interface for Console and File output (Iwritable) that I can perhaps pass to the Driver() so i can handle both types of output. Or is there an even better design to achieve this?