- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Say we have a parent abstract class:
module class_absParent public :: absParent type, abstract :: absParent contains procedure(interface_func1), public, deferred :: func1 end type abstract interface function interface_func1(self) result(dblResult) import :: absMaterial !! I want self be the child class not absParent, is it okay to use absMaterial in this line? class(absMaterial), intent(inout) :: self real*8 :: dblResult end function end interface ...
And the func1 in the child class needs to access the properties of child class so I want self to refer to the child class and not the parent abstract class.
module class_child use class_absParent implicit none public :: child type, extends(absParent) :: child ... function mat02_yield1(self) result(dblResult) !! does this contradicts the interface in parent class? class(child), intent(inout) :: self ... end function ...
I am getting error
The dummy arguments of an overriding and overridden binding that correspond by position must have the same characteristics, except for the type of the passed object dummy arguments.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
self can be an object of child class since "type of the passed object dummy arguments" can be different objects,
Error was caused since intent statement in Parent and Child classes were different.
Also related to this topic:
https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/280171

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