Virtual.cs C# code
Virtual.cs
===
class zzz
{
public static void Main()
{
yyy a = new xxx();
yyy b = new vvv();
xxx c = new vvv();
a.abc();a.pqr();a.xyz();b.abc();b.pqr();b.xyz();c.abc();c.pqr();c.xyz();}}
class yyy
{
public void abc()
{System.Console.WriteLine(”yyy abc”);}
public virtual void pqr()
{System.Console.WriteLine(”yyy pqr”);}
public virtual void xyz()
{System.Console.WriteLine(”yyy xyz”);}
}
class xxx : yyy
{
public virtual void abc()
{System.Console.WriteLine(”xxx abc”);}
public new void pqr()
{System.Console.WriteLine(”xxx pqr”);}
public override void xyz()
{System.Console.WriteLine(”xxx xyz”);}
}
class vvv : xxx
{
public override void abc()
{System.Console.WriteLine(”vvv abc”);}
public void xyz()
{System.Console.WriteLine(”vvv xyz”);}
}
Using.cs
===
Related postsusing System;
using ashish;
class zzz {
static void Main()
{
yyy.abc();
}
}
namespace ashish
{
class yyy
{
public static void abc()
{
Console.WriteLine(”abc”);
}
}
}
//After the word using you can only write the name of a namespace…