title: Is there an alternative to using a NotImplementedException when a subclass doesn't use a function in an abstract class?
body: <p>I'm making a simple web form to gather customer data and enter it into a database.     I have 5 sub-classes: <code>Customer</code>, <code>Bank</code>, <code>Employee</code>, <code>Owner</code>, and <code>TradeReference</code> which inherit from the abstract class, <code>DataEntry</code>.  <code>DataEntry</code> has a function <code>public void InsertSelfIntoDataBase(int id);</code>.  The id parameter is the primary key from the Customers Table (Bank, Employee, Owner and TradeReference have a many-to-one relationship with Customer), so a <code>Customer</code> doesn't need an id to be inserted (CustomerID is auto Incremented in the database).  </p>
  
  <p>Currently, my code is set up so that <code>Bank</code>, <code>Employee</code>, <code>Owner</code>, and <code>TradeReference</code> implements the <code>InsertSelfIntoDataBase</code> function in the parent class, while <code>Customer</code> throws a NotImplementedException, so the code for the <code>Customer</code> class code looks a little like this:</p>
  
  <pre><code>public int InsertSelfIntoDataBase()
  {
      int customerID = InsertCustomerAndReturnScalor();
      return customerID;
  }
  
  
  public override void insertSelfIntoDataBase(int id)
  {    throw new NotImplementedException("Customer does not use this function");    }
  </code></pre>
  
  <p>This implementation works, but it bugs me that I have to use a NotImplementedException; Like I can't shake the feeling that my professors form college somehow know and are silently judging me.  Is there a better way of doing this?</p>