using System;
class overriding
{
public static void Main()
{
classderived b=new classderived();
abstractclass i=b;
i.fun();//calls the derived class method
}
}
abstract class abstractclass
{
public abstract void fun();//fully virtual method,as it doesnot have any definition
}
class classderived:abstractclass
{
public override void fun()
{
Console.WriteLine("This method is derived class method");
}
}
class overriding
{
public static void Main()
{
classderived b=new classderived();
abstractclass i=b;
i.fun();//calls the derived class method
}
}
abstract class abstractclass
{
public abstract void fun();//fully virtual method,as it doesnot have any definition
}
class classderived:abstractclass
{
public override void fun()
{
Console.WriteLine("This method is derived class method");
}
}
No comments:
Post a Comment