diff --git a/structural/adapter/adapter_main b/structural/adapter/adapter_main index 413368f..837b430 100755 Binary files a/structural/adapter/adapter_main and b/structural/adapter/adapter_main differ diff --git a/structural/adapter/adapter_module.f90 b/structural/adapter/adapter_module.f90 index 8f285cf..0bc96e4 100644 --- a/structural/adapter/adapter_module.f90 +++ b/structural/adapter/adapter_module.f90 @@ -48,22 +48,26 @@ subroutine showSmilesInterface(this) end type concreteConsultant !Consultant adapter paves path between consultant and employee - type, extends(employee) :: consultantAdapter - class(consultant), allocatable :: c - contains - procedure :: showHappiness => showHappinessConsultantAdapterImpl - end type consultantAdapter + type, extends(employee), abstract :: consultantAdapterIntermediary + end type consultantAdapterIntermediary !Constructor for initializing the adapter interface consultantAdapter module procedure init_consultantAdapter end interface + + !Consultant adapter paves path between consultant and employee + type, extends(consultantAdapterIntermediary) :: consultantAdapter + class(consultant), allocatable :: c + contains + procedure :: showHappiness => showHappinessConsultantAdapterImpl + procedure :: showSmiles => showSmilesConsultantAdapterImpl + end type consultantAdapter contains type(consultantAdapter) function init_consultantAdapter(c) class(consultant), intent(in) :: c allocate(init_consultantAdapter%c, source = c) - init_consultantAdapter%happiness = c%smiles end function subroutine showHappinessImpl(this) @@ -78,6 +82,12 @@ subroutine showSmilesImpl(this) subroutine showHappinessConsultantAdapterImpl(this) class(consultantAdapter), intent(in) :: this - print *, this%happiness + print *, this%c%smiles + end subroutine + + + subroutine showSmilesConsultantAdapterImpl(this) + class(consultantAdapter), intent(in) :: this + print *, this%c%smiles end subroutine end module adapter_module \ No newline at end of file