class A
{
void show()
{
System.out.println("\n it is of a class");
}
}
class B extends A
{
void show()
{
System.out.println("\n it is of B class");
}
}
class C extends B
{
void show()
{
System.out.println("\n it is of C class");
}
}
class over
{
public static void main(String args[])
{
C c=new C();
A a =new A();
B b=new B();
A r;
r=a;
a.show();
r=b;
b.show();
r=c;
r.show();
}
}
{
void show()
{
System.out.println("\n it is of a class");
}
}
class B extends A
{
void show()
{
System.out.println("\n it is of B class");
}
}
class C extends B
{
void show()
{
System.out.println("\n it is of C class");
}
}
class over
{
public static void main(String args[])
{
C c=new C();
A a =new A();
B b=new B();
A r;
r=a;
a.show();
r=b;
b.show();
r=c;
r.show();
}
}
No comments:
Post a Comment