I have a Point3D class, Shapes abstract class, and a Sphere that extends Shapes.
I want Shapes to have a member object from Point3D.
public class Point3D
{
private float x, y, z;
public Point3D(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
}
public abstract class Shape
{
private Point3D point;
public Shape()
{
point = new Point3D() ;
}
}
public class Sphere extends Shape
{
private double radius;
public Sphere(float x, float y, float z, float radius)
{
// How do I pass the x, y ,z values to point3D?
}
}
I want to create the sphere but by making sure that I pass values to the point3D, how do I do it?
Also I have a feeling that putting a constructor on an abstract class is wrong.
Please help.






