{
C c1=new C();
B b1=c1;
A aa=b1; // or c1;
int r1=c1.m(10,20);
int r2=b1.m(10,5);
int r3=a1.m(10,5);
Response.Write(r1+"<br/>"+r2+"<br/>"+r3+"<br/>");
Public class A
{
public vartual int m(int x,int y)
{
return x+y;
}
}
public class B:A
{
public override int m(int a,int b)
{
return a-b;
}
}
public class C:B
{
Public override int m(int x,int y)
{
return 2*(x-y);
}
}
Note: output will be come like(?)
C c1=new C();
B b1=c1;
A aa=b1; // or c1;
int r1=c1.m(10,20);
int r2=b1.m(10,5);
int r3=a1.m(10,5);
Response.Write(r1+"<br/>"+r2+"<br/>"+r3+"<br/>");
Public class A
{
public vartual int m(int x,int y)
{
return x+y;
}
}
public class B:A
{
public override int m(int a,int b)
{
return a-b;
}
}
public class C:B
{
Public override int m(int x,int y)
{
return 2*(x-y);
}
}
Note: output will be come like(?)
No comments:
Post a Comment