A Fortran function/subroutine that could return either a real, an integer or a string.
问题 I would like to know how to create a function that either returns a real, an integer or a string. For example, the call would be write(*,*)dt%get() where get() would return : an integer if dt%isInteger = .true. a real if dt%isReal = .true. a character if dt%isStr = .true. I believe this might be possible by using an abstract interface to make procedure get() point to either procedure getInteger() , getReal() or getStr() but the abstract interface definition needs to define the ouput type