CGI Interview Question

What is Dependency Injection and IoC - Inversion of control? Show it in your code, explain how that works.