Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

F2003 inheritance & procedure polymorphism

Status
Not open for further replies.

ajay235

Technical User
Oct 25, 2012
1
US
Hi,

I'm new to OOPS concepts in fortran but have some idea of them in C. I have three modules of which one is base type and has initialize subroutine that is common to two of its EXTENDS types. Now, I want to use the same subroutine for both of its derived types when passing them as argument. The type of the argument has to be given in the initialize routine. The only way I could get it to compile is by giving its type as class(base_type). But when I run the problem, the values modified inside that initialize routine seems to be valid only in that routine and are reset to garbage values immediately after coming out of it.

any idea?

Thanks!
 
.... and that is where the trouble began ...

I guess the typical Fortran programmer is either one of the three types

- people who just want to have some computations done - without too long a learning curve
- people that work on big data crunchers
- people - like me - that never made it to get to grips with object oriented programming, guys that use the letters oops to express something else.

Neither of them will have a big benefit from using inheritance and other OOP related concepts, at least to what I think I understood of these.
So I pretty much doubt that you will find somebody to be of assistance to your problem, for in my picture anybody utilizing OOP will use C++, Java or one of the other fancy PLs.

But I wish you good luck.

Norbert

The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top