Resolved Do i have to Create an object each time i want to access a method from another class?

sock1992

Well-known member
Joined
May 20, 2020
Messages
107
Programming Experience
Beginner
I've created a logging class which includes a method that I want to access whenever I'd like to log an event. At the moment I'm having to create an instance each time I want to use that method. Is there a better way to do this?
 
Last edited:
Yes. Dependency injection.
 
Back
Top Bottom