I am writing some code in fortran that defines certain shapes.
Currently I have a cuboid and a prism. Now a parallelepiped is both a cuboid and a prism. Is there a way to code this?
Currently I only have
How can I do so that Parallelepipied is also a Prism.
I think this is a case of multiple inheritance, also called the diamond
of death and is usually problematic. However, such constructs occur
frequently in mathematics.
A cuboid is a prism, and a parallelepiped is a prism, too. And, "... a parallelepiped is both a cuboid..." is not true, but vice versa. Make prism the ancestor and inherit the two others from there.
A cuboid is a polyhedron bounded by six quadrilateral faces.
A prism is a polyhedron where all vertices lie in two parallel planes, having an equal number of vertices in each of the two parallel planes, and the n-point polygons of the two parallel bases are congruent to one another with the same rotational orientation.
Hi guys,
I have a three class:
1. Class Algorithm having max() finding maximum value in a Collection
public class Algorithm {
public static <T extends Comparable<T>> T max(Collection<? extends T> coll) {
T max = coll.iterator().next();
for (T elm : coll) {
... (0 Replies)