Create a class called Point3D to represent 3D point in space, a class called Sphere and a class called Cylinder. The sphere is characterized by its center point and the radius while the Cylinder can be characterized by its center point, radius and height..
In your design provide a constructor for each class that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initializers are provided. Provide public member functions to set/get private data members, to calculate the surface area and the volume for each class in the hierarchy. You must write you code in two different approaches:
- Incorporate inheritance to implement the class hierarchy for the three classes Point3D, Sphere and Cylinder using inheritance.
- Many programs written with inheritance could be written with composition instead, and vice versa. Rewrite the classes Point3D, Sphere and Cylinder using composition rather than inheritance