public class Parent1
{
public Parent1()
{
}
public void SayHello()
{
}
public void SayHi()
{
}
}
public class Parent2
{
public Parent2()
{
}
public void SayHello()
{
}
public void SayHi()
{
}
}
public class Child : Parent1,Parent2-- Its not possible just for understanding
{
public void SayHi123()
{
}
}
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Child objChild = new Child();
objChild.SayHello();
objChild.SayHi();
}
}
In the above scenario when you call the
SayHello or
SayHi methods by creating instance of chhild class... that time there is ambiguity from which parent mmethod should get called (Parent1 or Parent2) so they are not allowing to inherit multiple classes... but we can achive the same by multilevel or by interface .