</div>

<div class="language-c++ good col-sm-6 highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// factor out common</span>

<span class="n">setColor</span><span class="p">(</span><span class="s">"black"</span><span class="p">);</span>

<span class="k">if</span> <span class="p">(</span><span class="n">tool</span> <span class="o">==</span> <span class="n">CIRCLE</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">drawCircle</span><span class="p">