Virtual Override



Similar to C# code for virtual we provide you Virtual OverRide code

class zzz
{
public static void Main()
{
yyy a = new yyy();xxx b = new xxx();yyy c = new xxx();
a.abc();a.pqr();a.xyz();
b.abc();b.pqr();b.xyz();
c.abc();c.pqr();c.xyz();
}}
class yyy
{
public virtual 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 override void abc()
{System.Console.WriteLine(”xxx abc”);}
public new void pqr()
//New means that the function pqr is a new function and it has absolutely nothing to do with the pqr in the base class
{
System.Console.WriteLine(”xxx pqr”);
}
public void xyz()
{
System.Console.WriteLine(”xxx xyz”);
}}

Related posts

  • Override in C#
  • Virtual.cs C# code
  • Abstract classes in C#
  • VIRTUAL TELNET
  • MICROCITIES
  • SLOT MACHINE
  • CLICKBLASTER


  • Leave a Reply

    You must be logged in to post a comment.