 <p>You could use a wrapper class:</p> <pre><code>Class ABWrapper { private AB m_AB; ABWrapper( AB ab ) { m_AB = new AB(); } public void execute() { // Do your stuff, then call original method m_AB.execute(); } } </code></pre> <p>This is a good approach when <code>AB</code> implements an <em>interface</em> (you did not mention that, though). In this case <code>ABWrapper</code> should implement the same interface. When you use a <em>factory</em> or even <em>dependency injection</em> to create your <code>AB</code> instances you can replace them there easily with your wrapper.</p>