using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication34
{
public class bc
{
public virtual void display()
{
Console.WriteLine("iam virtual method");
}
}
public class dc : bc
{
public override void display()
{
Console.WriteLine("iam override method");
}
}
class Program
{
static void Main(string[] args)
{
bc b;
b = new bc();
b.display();
b = new dc();
b.display();
}
}
}
Output screen:
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication34
{
public class bc
{
public virtual void display()
{
Console.WriteLine("iam virtual method");
}
}
public class dc : bc
{
public override void display()
{
Console.WriteLine("iam override method");
}
}
class Program
{
static void Main(string[] args)
{
bc b;
b = new bc();
b.display();
b = new dc();
b.display();
}
}
}
Output screen:
No comments:
Post a Comment