Relative Content

Tag Archive for javaclassinheritancetype-conversionsuperclass

Is it possible to override a Point2D object from a superclass to a Point2D.Float?

I have defined a class called “Entity” with a Point2D object in it called “pos”. The class is a superclass and it’s not specified if “pos” should be a Point2D.Float or a Point2D.Double, that’s left for the inheritors to decide. The problem is I don’t know how to override this object to make it a Point2D.Float (for example) without getting an error.