title: Inherited class override virtual method dependency
body: <p>I have these 2 classes:</p>
  
  <pre><code>type
    TMyBaseClass = class
    protected
      FAllowDoSomething: Boolean; // initialized to False
      procedure DoSomething; virtual;
    end;
  
    TMyChildClass = class(TMyBaseClass)
    protected
      procedure DoSomething; override;
    end;
  
  implementation
  
  procedure TMyBaseClass.DoSomething;
  begin
    if not FAllowDoSomething then Exit; // Abort;
    ShowMessage('TMyBaseClass: FAllowDoSomething is False. You wont see me!');
  end;
  
  procedure TMyChildClass.DoSomething;
  begin
    inherited; // Must inherit
    // if not FAllowDoSomething then Exit; { I don't want to check here again }
    ShowMessage('TMyChildClass: FAllowDoSomething is False but still I can see this message!');
  end;
  
  procedure TForm1.Button1Click(Sender: TObject);
  begin
    with TMyBaseClass.Create do try
      DoSomething;
    finally
      Free;
    end;    
  
    // if I use Abort in TMyBaseClass, the code will not get here
  
    with TMyChildClass.Create do try
      DoSomething;
    finally
      Free;
    end;
  end;
  </code></pre>
  
  <p>In <code>TMyChildClass.DoSomething</code> I must <code>inherited</code> the <code>TMyBaseClass.DoSomething</code> but I want it to respect the <code>if not FAllowDoSomething then &lt;don't do anything&gt;</code>.</p>
  
  <p>I have tried using <code>Abort</code> in the <code>TMyBaseClass</code> but I realize it's not a good idea and will break the calling method (<code>TForm1.Button1Click</code>);</p>
  
  <p>What is the correct approach of doing this, without writing the <code>if not FAllowDoSomething then Exit</code> <strong>again</strong> in <code>TMyChildClass</code>.</p>