private void Test()
{
a obja = new c();obja.ao();
}
class a{public virtual void ao() { Console.WriteLine("a"); }}
class b:a{public virtual void ao() { Console.WriteLine("b"); }}
class c:b{public override void ao() { Console.WriteLine("c"); }}
//Output : a
private void Test()
{
a obja = new c();obja.ao();
}
class a{public virtual void ao() { Console.WriteLine("a"); }}
class b:a{public override void ao() { Console.WriteLine("b"); }}
class c:b{public override void ao() { Console.WriteLine("c"); }}
//Output : b
private void Test()
{
a obja = new c();obja.ao();
}
class a{public virtual void ao() { Console.WriteLine("a"); }}
class b:a{//public virtual void ao() { Console.WriteLine("b"); }}
class c:b{public override void ao() { Console.WriteLine("c"); }}
//Output : c
private void Test()
{
a obja = new c();obja.ao();
}
class a{public virtual void ao() { Console.WriteLine("a"); }}
class b:a{public new void ao() { Console.WriteLine("b"); }}
class c:b{public void ao() { Console.WriteLine("c"); }}
//Output : a
{
a obja = new c();obja.ao();
}
class a{public virtual void ao() { Console.WriteLine("a"); }}
class b:a{public virtual void ao() { Console.WriteLine("b"); }}
class c:b{public override void ao() { Console.WriteLine("c"); }}
//Output : a
private void Test()
{
a obja = new c();obja.ao();
}
class a{public virtual void ao() { Console.WriteLine("a"); }}
class b:a{public override void ao() { Console.WriteLine("b"); }}
class c:b{public override void ao() { Console.WriteLine("c"); }}
//Output : b
private void Test()
{
a obja = new c();obja.ao();
}
class a{public virtual void ao() { Console.WriteLine("a"); }}
class b:a{//public virtual void ao() { Console.WriteLine("b"); }}
class c:b{public override void ao() { Console.WriteLine("c"); }}
//Output : c
private void Test()
{
a obja = new c();obja.ao();
}
class a{public virtual void ao() { Console.WriteLine("a"); }}
class b:a{public new void ao() { Console.WriteLine("b"); }}
class c:b{public void ao() { Console.WriteLine("c"); }}
//Output : a
No comments:
Post a Comment