Hi, everyone. I'd like to suggest the following code:
module test1 implicit none type :: a integer :: sa end type a end module test1 module test2 use test1 implicit none type,extends(a) :: b private integer :: sb end type b end module test2 program main use test2 implicit none type(b) :: var write(*,*) var%sa ! sa can be accessed. write(*,*) var%sb ! sb is blocked. end program main
Here comes the question: How can I block sa to be seen from the outside of the type defination module test2 ? In other words how can sa made to be a private variable within type b ? Appriciate any ideas and many thanks.
Zone:
Thread Topic:
Question