Why do we use virtual and override?
<p>Why do we use override and virtual if it gives the same effect when we dont use override and virtual?</p>

<p>example 1:</p>

<pre><code>class BaseClass
{
    public virtual string call()
    {
        return "A";
    }
}

class DerivedClass : BaseClass
{
    public override string call()
    {
        return "B";
    }
}
</code></pre>

<p><strong>output : B</strong></p>

<p>Example 2:</p>

<pre><code>class BaseClass
{
    public string call()
    {
        return "A";
    }
}

class DerivedClass : BaseClass
{
    public string call()
    {
        return "B";
    }
}
</code></pre>

<p>and the output is still the same:</p>

<p><strong>output : B</strong></p>

<p>to run the test:</p>

<pre><code>class Program
{
    static void Main(string[] args)
    {
        DerivedClass dc = new DerivedClass();
        Console.WriteLine(dc.call());
        Console.ReadKey();
    }
}
</code></pre>

<p>Does the compiler add virtual and override automatically at compile time?</p>

<p>I would be pleased if someone would explain to me the reason for using virtual and override.</p>
