Thursday, December 6, 2018

Dependency Injection Example

Dependency injection is providing the objects that an object needs (its dependencies) instead of having it construct them itself. It's a very useful technique for testing, since it allows dependencies to be mocked or stubbed out.

Here is an example of dependency injection through constructor.

No comments: