Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Oo f90

  1. Mar 17, 2010 #1
    Hi I have a little issue with f90.

    I am a c++ programmer but I have to use fortran for this project.

    f90 the compiler does seem to distinguish between methods from user defined types. I have two types one "has a" instance of the other. Both have a methods named Print (with different typed arguments and in different modules). I want both of my user efined types to have the method named Print. The compiler wont let me define both!

    here is an example

    Code (Text):

    module BoxModule
    type Box
    ...
    end type
    contains
    subroutine Print(b)
    type(Box) b
    ...
    end subroutine
    end module

    module OtherModule
    type Other
    ...
    type(Box) b
    ...
    end type
    contains
    subroutine Print(o) ! <----------------------------- compiler doesn't like this
    type(Other) o
    ...
    Print(o%b)
    ...
    end subroutine
    end module
     
    here is the error

    Code (Text):

    subroutine Print(c)
                    1
    use BoxModule
           2
    Error: Procedure 'print' at (1) is already defined at (2)
     
    Howe can I have both user dfeind type have a function named Print?
     
  2. jcsd
  3. Apr 3, 2010 #2
    I believe f90 already have a intrinsic print function.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Oo f90
  1. Largest number in f90 (Replies: 13)

Loading...