java 实现多重继承
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();
}