I have a basic object oriented architecture question. Suppose I have a class in VB.NET called OutputLog. It has methods "Create", "Write", and "Read".
In my program I have numerous classes in which I want to write to one log file. So, if I have a startup class for me program, which has:
Public Class Main
logFile = new OutputLog()
logFile.create("c:\abc.log")
logFile.write("first entry to the log file")
End Class
Public Class Two
"I want to write to this same log file in this class"
End Class
Public Class OutputLog
Methods to "Create", "Write" and "Read"
End Class
What is the best way to architect this? I could pass the reference to logFile in the constructor of Class Two? Is this the best way to handle this? This would mean that for every class I want to write out to the log file I would need to pass logFile in the constructor?
Thanks