Should I override unused methods
04:02 14 Oct 2026

I have an abstract base class that has a method to get some data. Concrete classes provide a query which this mehtod uses to retrieve that data. The class looks like this:

public abstract class BaseClass
{
   public virtual Data GetData()
   {
      var query = CreateQuery();
      var data = ... // using the query to get the data
      return data;
   }

   protected abstract Query CreateQuery();
}

A concrete implementation of this base class looks like this:

public class ConcreteClass : BaseClass
{
    protected override Query CreateQuery()
    {
        var query = new Query();
        // ... 
        return query;
    }
}

Now I have another class which should inherit from the above conctete implementation. This class doesn't retrieve the data via a query but creates it with some other mechanisms. Therefore it overrides the GetData method:

public class SpecializedClass : ConcreteClass
{
    public override Data GetData()
    {
        var data = /* Create the data */
        return data;
    } 
}

Should SpecializedClass override CreateQuery as well even if CreateQuery doesn't get used here? My example is in C# as that's the language I use but language agnostic answers are welcome.

best-practices oop overriding