27 lines
294 B
Java
Executable File
27 lines
294 B
Java
Executable File
class A{
|
|
public m() {
|
|
return new A();
|
|
}
|
|
}
|
|
|
|
class B extends A{
|
|
|
|
public m() {
|
|
return new B();
|
|
}
|
|
public m(java.lang.Integer a) {
|
|
return a;
|
|
}
|
|
}
|
|
|
|
public class TestInheritanceOverriding {
|
|
|
|
public main1(x,A y) {
|
|
y = new B();
|
|
x = y.m();
|
|
}
|
|
/*public main2(x) {
|
|
y;
|
|
y=x.m(2);
|
|
}*/
|
|
} |