get a reference to the container (class/module/image) look up a specific function/method in that container replace that code with your modified implementation After which, you likely care about being able to "proceed" to the original implementation (the one that existed before your modifications), possibly at a different time, or passing different arguments.