title: How to add control over invoking of methods in existing sub classes without modifying the sub classes?
body: <p>I have some <code>BaseClass</code> with some method <code>void doSomething()</code>.</p>
  
  <p>There are different ways to <code>foSomething</code> and they are implemented by <code>SubClass1</code>, <code>SubClass2</code> and <code>SubClass3</code>.</p>
  
  <p>Now I want to add a <code>Boolean active</code> property to the <code>BaseClass</code> so that when <code>doSomething</code> is called on an instance it will just return without doing anything.</p>
  
  <p>I know I can code the <code>BaseClass</code> to have <code>doSomething()</code> that looks something like:</p>
  
  <pre><code>Void doSomething(){
     if (this.getActive()) actuallyDoSomething();
  }
  </code></pre>
  
  <p>And then <code>@Override actuallyDoSomething()</code>  instead of <code>@Override doSomething()</code> in the subclasses.
  but it feels wrong... in the sense that It has already been agreed that the subclasses should provide an implementation for <code>doSomething()</code> and they are not aware of <code>actuallyDoSomething()</code>.</p>
  
  <p>I also can have each sub class add an <code>if (!this.getActive()) return;</code> at the beginning of its implementation of <code>doSomething()</code> but this also seems wrong as its common functionality that I would prefer to keep common.</p>
  
  <p>What is the common/best practice way to do this?
  Can it be done without changing the sub classes?</p>
  
  <p><strong>Update</strong></p>
  
  <p>The focus of the Q is not about the right way to design such functionality (which is quite simple), 
  but on how such functionality can be <strong>added</strong> to an existing scenario without breaking anything.</p>
  
  <p><code>active</code> would be true by default, but it is desired that on any instance of any the said sub classes if someone would call <code>setActive(false)</code> then it will become inactive and consecutive calls to <code>.doSomething()</code> will not do anything...</p>