1. Take 2 labels in .aspx page
2. Use following code in .aspx.cs pafe
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Inheritance : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Vehical obj = new Vehical();
lblCar.Text = ((car)obj).Drive();
lblBus.Text = ((bus)obj).Drive();
}
interface car
{
string Drive();
}
interface bus
{
string Drive();
}
class Vehical:car,bus
{
string car.Drive()
{
return "I am in CAR";
}
string bus.Drive()
{
return "I am in BUS";
}
}
}