- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Short version:
We have class element with property of material
We have class steel and class concrete as materials.
I want that the element be able to receive either steel class or concrete class as element%material property.
What approach should I use to make this possible?
____________________________________________________________________________________
Detailed version:
Say we have a Hex element.
Elements can receive one material from various types as property say Concrete or Steel.
All materials have some common properties for example modulus of elasticity.
They also have some common methods but the way that the methods do a calculation is different for each material.
For example:
Concrete%Yield() will do calculations and return a value different from how Steel%Yield() would, but both materials have Yield() method which is accessed from element class.
Now I want my Hex element have a material property.
I created an abstract class material with property of material%Elastic_modulus and a differed method of material%Yield().
I want to create Hex class with abstract class of material as a property so I can use steel%material or concrete%material to assign my material to element. But I receive compiler error 8313:
The TYPE(derived-type-spec) shall not specify an abstract type.
So if this is not allowed how can I have a class element which can receive either concrete or steel class as material property?
____________________________________________________________________________________
I would appreciate your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SPMay wrote:
.. I want to create Hex class with abstract class of material as a property so I can use steel%material or concrete%material to assign my material to element. But I receive compiler error 8313: ..
Use CLASS statement instead of TYPE but with a suitable attribute specifier, preferably ALLOCATABLE:
https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide-and-reference-class
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SPMay wrote:
.. I want to create Hex class with abstract class of material as a property so I can use steel%material or concrete%material to assign my material to element. But I receive compiler error 8313: ..
Use CLASS statement instead of TYPE but with a suitable attribute specifier, preferably ALLOCATABLE:
https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide-and-reference-class

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page