内部类实现多继承

pipidi

zhujingdi1998@gmail.com

/**
 * Created by Administrator on 2018/9/19.
 */
public class Boy {
}

class MyMath{
    int getAdd(int i,int j){
        return i+j;
    }
}

public class Son extends Boy{
    private class OtherFunction extends MyMath{
        int getMultiply(int i ,int j){
            return i*j;
        }
    }
    public int getAdd(int i,int j){
        return new OtherFunction().getAdd(i,j);
    }
    public int getMultiply(int i,int j ){
        return  new OtherFunction().getMultiply(i,j);
    }

}

阅读量