Print

Print


Giampaolo Bottoni said:
> The f2k PDF draft is a book of more than 400 pages!  :-(

So we are about halfway between the F95 standard (355 pages) and
the C99 standard (554 pages).  Big deal.

> Using template:
>
> type::point
>     real ::x,y,z
> end type point
> type :: event
>     real:: x,y,z,t
> end type event
>
> type(event)::bigbang
>
> subroutine rotation(p)
>    template(point)::p    !!! Hic sunt leones (old Latin maxim)
>    ...
> end subroutine rotation
>
> call rotation(bigbang)  !!! CORRECT,RIGHT !!!
>
> Please, may you briefly explain to me (and, why not, to all the
> [log in to unmask] members) how can I obtain
> the same effect using the new and powerful object
> oriented f2k instructions ?

MODULE points_and_events
  TYPE,EXTENSIBLE :: point
    REAL x,y,z
  END TYPE
  TYPE,EXTENDS(point) :: event
    REAL t
  END TYPE
CONTAINS
  SUBROUTINE rotation(p)
    CLASS(point) p
    ...
  END SUBROUTINE
END MODULE
PROGRAM example
  USE points_and_events
  TYPE(event) bigbang
  ...
  CALL rotation(bigbang)
  ...
END PROGRAM

> The type event must be of necessity an extension
> of the type point ?

Yes.

There was some tutorial material about these facilities published in
Fortran Forum:

"Object Orientation and Fortran 2002: Part I", Fortran Forum, Vol. 16, No. 3
(December 1997).

"Object Orientation and Fortran 2002: Part II", Fortran Forum, Vol 18, No. 1
(April 1999).

Part II is self-contained, and describes most of the object-oriented features.
Part I looks at some of the simpler features in greater detail (and with a
slightly different syntax from the current draft).

Cheers,
--
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
                           ([log in to unmask])

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp