Difference between virtual and abstract methods [duplicate]

Here is some code from MSDN:

// compile with: /target:library 
public class D
{
    public virtual void DoWork(int i)
    {
        // Original implementation.
    }
}

public abstract class E : D
{
    public abstract override void DoWork(int i);
}

public class F : E
{
    public override void DoWork(int i)
    {
        // New implementation.
    }
}

Can anyone explain the above code with respect to the differences between abstract and virtual methods?

4 Answers
4

Leave a Comment