FORTRAN Extends


 
Thread Tools Search this Thread
Top Forums Programming FORTRAN Extends
# 1  
Old 10-19-2014
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

Code:
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.

Last edited by kristinu; 10-19-2014 at 10:31 AM..
# 2  
Old 10-19-2014
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.
# 3  
Old 10-21-2014
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.
# 4  
Old 10-21-2014
Cuboid -- from Wolfram MathWorld (and others):
Quote:
...The cuboid is also a right prism, a special case of the parallelepiped...
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Programming

Problem with <T extends Comparable<? super T>>>

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)
Discussion started by: majid.merkava
0 Replies
Login or Register to Ask a Question