Question: Given the following pseudo C# code:

```
public abstract class Worker
{
    public void DoWork()
    {
         Prepare();
         Work();
         Cleanup();
    }

    protected abstract void Work();
}

```

With this design, it is possible, that a derived class (which overrides the `Work()` method) calls the `Work()` method directly.

I'm looking for design tips on how to prevent any subclass to do this call, or at least generate a compiler warning.

Why I want to do this?
The Worker actually dispatches the `Work()` to another thread. `DoWork()` takes care about the locking.

---

I know, this is weird. The `Work()`-body might just consist of a method call to `DoMyWork()` and the object might call `DoMyWork()` somewhere else. It's impossible to intercept that.

Anyways. I appreciate any thoughts on that issue.

Answer: 
Thanks to Eris and Corey I think I figured it out. What about this way:

```
public abstract class Worker
{
    public void DoWork()
    {
         if (Work != null)
         {
             Prepare();
             Work();
             Cleanup();
         }
    }

    protected Action Work { private get; set; }
}

public class ImplWorker {
    public ImplWorker() {
        Work = //whatever
    }
}

```

Still if he really wanted to he can store it somewhere else and stuff. But it goes as far as I can imagine.
This is somewhat of a hack, but you could change the method to be virtual, add a body which calls the new method, and then add an [ObsoleteAttribute](https://msdn.microsoft.com/en-us/library/22kk2b44(v=vs.90).aspx) to it.

```
    protected void DoWork()
    {
        // New method
    }

    [Obsolete("This method is deprecated.")]
    protected virtual void Work()
    {
        DoWork();
    }

```

Marking the method as virtual will prevent any existing child classes from breaking, since they were previously required to override Work().