java 实现多重继承
原创
©著作权归作者所有:来自51CTO博客作者mb636514f3a19f5的原创作品,请联系作者获取转载授权,否则将追究法律责任
package com.yangll;
//多重继承类
public class ClassTestylll extends Person1 {
class inner extends Machine1{
@Override
void run() {
// TODO Auto-generated method stub
System.out.println("Machine1 is run");
}
}
public void run1(){
this.run();
}
public void run2(){
new inner().run();
}
public void run3(ClassTestylll a){
a.run();
}
public void run4(inner b){
b.run();
}
public inner getInner(){
return new inner();
}
public static void main(String[] args){
ClassTestylll t = new ClassTestylll();
t.run1();
t.run2();
t.run3(t);
t.run4(t.getInner());
}
}
class Person1{
public void run(){System.out.println("Persion1 is run");};
}
abstract class Machine1{
abstract void run();
}