Complex Inheritance

Complex Inheritance

Hi everybody,I am wondering if there is any way to implement this kind of thing:

  type,abstract :: c_father_b
    ...
  end type c_father_b
!-------------------------------
  type, extends(c_father_b) :: c_child_b
    ...
  end type c_child_b
!-------------------------------
  type,abstract :: c_father_a
    class(c_father_b), pointer :: ptr_to_b
  end type c_father_a
!-------------------------------
  type, extends(c_father_a) :: c_child_a
    type(c_child_b), pointer :: ptr_to_b
  end type c_child_a

The reason is that I have a main abstrac class (A) which have a pointer to another abstract class(B). However, in SOME of the children of A will ALWAYS have this pointer to a specific children of B. The way I have it implemented now is using the pointer for c_father_a and having type select all around the code, which we must agree, its not beautiful at all. Is there any workaround for that and/or a plan to the implementation of this feature?Thanks in advance!

1 contenuto / 0 nuovi
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione