FORTRAN Extends

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

Type, Extends (Cuboid) :: Parallelepipied

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 not a prism.

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.

Cuboid -- from Wolfram MathWorld (and others):