Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm reading through some code. In the constructor it has super() but the class implements interface which of course doesn't have a constructor. So which super() it is referring to?

public class BoundingBox implements IBoundingVolume {

public BoundingBox() {
        super();
        mTransformedMin = new Number3D();
        mTransformedMax = new Number3D();
        mTmpMin = new Number3D();
        mTmpMax = new Number3D();
        mPoints = new Number3D[8];
        mTmp = new Number3D[8];
        mMin = new Number3D();
        mMax = new Number3D();
        for(int i=0; i<8; ++i) {
            mPoints[i] = new Number3D();
            mTmp[i] = new Number3D();
        }
}


public interface IBoundingVolume {
    public void calculateBounds(Geometry3D geometry);
    public void drawBoundingVolume(Camera camera, float[] projMatrix, float[] vMatrix, float[] mMatrix);
    public void transform(float[] matrix);
    public boolean intersectsWith(IBoundingVolume boundingVolume);
    public BaseObject3D getVisual();
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
105 views
Welcome To Ask or Share your Answers For Others

1 Answer

super() refers to the extended class (not an implemented interface). Which in this case is Object

So it will call the constructor in Object (Which does nothing)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...