Answers for "c# virtual vs abstract"

C#
4

c# virtual vs abstract

public abstract class E
{
    public abstract void AbstractMethod(int i);

    public virtual void VirtualMethod(int i)
    {
        // Default implementation which can be overridden by subclasses.
    }
}

public class D : E
{
    public override void AbstractMethod(int i)
    {
        // You HAVE to override this method
    }
    public override void VirtualMethod(int i)
    {
        // You are allowed to override this method.
    }
}
Posted by: Guest on August-05-2020

Code answers related to "c# virtual vs abstract"

C# Answers by Framework

Browse Popular Code Answers by Language